diff options
author | mav <mav@FreeBSD.org> | 2015-11-27 14:38:36 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-11-27 14:38:36 +0000 |
commit | 7dbdf0a143fde2a518d5d710a14d47b8f1c80702 (patch) | |
tree | 4c7b6f7ad055db4c182bb626a082618d7399d4be /sys/rpc | |
parent | 11814c27fd3b1050198f173bafda29c66d0c79d3 (diff) | |
download | FreeBSD-src-7dbdf0a143fde2a518d5d710a14d47b8f1c80702.zip FreeBSD-src-7dbdf0a143fde2a518d5d710a14d47b8f1c80702.tar.gz |
MFC r291061: Improve locking of sg_threadcount.
Diffstat (limited to 'sys/rpc')
-rw-r--r-- | sys/rpc/svc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/rpc/svc.c b/sys/rpc/svc.c index 228b2aa..f725d53 100644 --- a/sys/rpc/svc.c +++ b/sys/rpc/svc.c @@ -1303,7 +1303,9 @@ svc_new_thread(SVCGROUP *grp) SVCPOOL *pool = grp->sg_pool; struct thread *td; + mtx_lock(&grp->sg_lock); grp->sg_threadcount++; + mtx_unlock(&grp->sg_lock); kthread_add(svc_thread_start, grp, pool->sp_proc, &td, 0, 0, "%s: service", pool->sp_name); } @@ -1336,12 +1338,12 @@ svc_run(SVCPOOL *pool) } /* Starting threads */ + pool->sp_groups[0].sg_threadcount++; for (g = 0; g < pool->sp_groupcount; g++) { grp = &pool->sp_groups[g]; for (i = ((g == 0) ? 1 : 0); i < grp->sg_minthreads; i++) svc_new_thread(grp); } - pool->sp_groups[0].sg_threadcount++; svc_run_internal(&pool->sp_groups[0], TRUE); /* Waiting for threads to stop. */ |