aboutsummaryrefslogtreecommitdiff
path: root/src/core/taskq.c
diff options
context:
space:
mode:
authorMatt Gigli <mjgigli@gmail.com>2018-12-09 15:28:10 -0800
committerGarrett D'Amore <garrett@damore.org>2018-12-16 08:55:07 -0800
commitb19e1bfb8305450ec04077dcae539c7049824796 (patch)
tree795be0d560b2528b8e7ad632320ad347a0def9bd /src/core/taskq.c
parentebefc71efae64b72ce75efe10c447344edf7242f (diff)
downloadnng-b19e1bfb8305450ec04077dcae539c7049824796.tar.gz
nng-b19e1bfb8305450ec04077dcae539c7049824796.tar.bz2
nng-b19e1bfb8305450ec04077dcae539c7049824796.zip
fixes #769 How to limit worker threads
* Expose cmake variable to set number of DNS resolver threads: NNG_RESOLV_CONCURRENCY * Expose cmake variable to set number of taskq threads: NNG_NUM_TASKQ_THREADS
Diffstat (limited to 'src/core/taskq.c')
-rw-r--r--src/core/taskq.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/taskq.c b/src/core/taskq.c
index 9dde6981..12a986b1 100644
--- a/src/core/taskq.c
+++ b/src/core/taskq.c
@@ -266,10 +266,14 @@ nni_taskq_sys_init(void)
{
int nthrs;
+#ifndef NNG_NUM_TASKQ_THREADS
nthrs = nni_plat_ncpu() * 2;
if (nthrs < 2) {
nthrs = 2;
}
+#else
+ nthrs = NNG_NUM_TASKQ_THREADS;
+#endif
return (nni_taskq_init(&nni_taskq_systq, nthrs));
}