Lines 1129-1134
svc_run_internal(SVCGROUP *grp, bool_t i
Link Here
|
1129 |
if (grp->sg_state == SVCPOOL_THREADWANTED) { |
1129 |
if (grp->sg_state == SVCPOOL_THREADWANTED) { |
1130 |
grp->sg_state = SVCPOOL_THREADSTARTING; |
1130 |
grp->sg_state = SVCPOOL_THREADSTARTING; |
1131 |
grp->sg_lastcreatetime = time_uptime; |
1131 |
grp->sg_lastcreatetime = time_uptime; |
|
|
1132 |
grp->sg_threadcount++; |
1132 |
mtx_unlock(&grp->sg_lock); |
1133 |
mtx_unlock(&grp->sg_lock); |
1133 |
svc_new_thread(grp); |
1134 |
svc_new_thread(grp); |
1134 |
mtx_lock(&grp->sg_lock); |
1135 |
mtx_lock(&grp->sg_lock); |
Lines 1303-1309
svc_new_thread(SVCGROUP *grp)
Link Here
|
1303 |
SVCPOOL *pool = grp->sg_pool; |
1304 |
SVCPOOL *pool = grp->sg_pool; |
1304 |
struct thread *td; |
1305 |
struct thread *td; |
1305 |
|
1306 |
|
1306 |
grp->sg_threadcount++; |
|
|
1307 |
kthread_add(svc_thread_start, grp, pool->sp_proc, &td, 0, 0, |
1307 |
kthread_add(svc_thread_start, grp, pool->sp_proc, &td, 0, 0, |
1308 |
"%s: service", pool->sp_name); |
1308 |
"%s: service", pool->sp_name); |
1309 |
} |
1309 |
} |
Lines 1338-1347
svc_run(SVCPOOL *pool)
Link Here
|
1338 |
/* Starting threads */ |
1338 |
/* Starting threads */ |
1339 |
for (g = 0; g < pool->sp_groupcount; g++) { |
1339 |
for (g = 0; g < pool->sp_groupcount; g++) { |
1340 |
grp = &pool->sp_groups[g]; |
1340 |
grp = &pool->sp_groups[g]; |
1341 |
for (i = ((g == 0) ? 1 : 0); i < grp->sg_minthreads; i++) |
1341 |
for (i = ((g == 0) ? 1 : 0); i < grp->sg_minthreads; i++) { |
|
|
1342 |
/* |
1343 |
* Although this code is single threaded, acquire |
1344 |
* the mutex, since svc_new_thread() will create |
1345 |
* threads that are manipulating sg_threadcount. |
1346 |
*/ |
1347 |
mtx_lock(&grp->sg_lock); |
1348 |
grp->sg_threadcount++; |
1349 |
mtx_unlock(&grp->sg_lock); |
1342 |
svc_new_thread(grp); |
1350 |
svc_new_thread(grp); |
|
|
1351 |
} |
1343 |
} |
1352 |
} |
|
|
1353 |
mtx_lock(&pool->sp_groups[0].sg_lock); |
1344 |
pool->sp_groups[0].sg_threadcount++; |
1354 |
pool->sp_groups[0].sg_threadcount++; |
|
|
1355 |
mtx_unlock(&pool->sp_groups[0].sg_lock); |
1345 |
svc_run_internal(&pool->sp_groups[0], TRUE); |
1356 |
svc_run_internal(&pool->sp_groups[0], TRUE); |
1346 |
|
1357 |
|
1347 |
/* Waiting for threads to stop. */ |
1358 |
/* Waiting for threads to stop. */ |