diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/taskq.c | 4 | ||||
| -rw-r--r-- | src/platform/posix/posix_resolv_gai.c | 12 | ||||
| -rw-r--r-- | src/platform/windows/win_resolv.c | 12 |
3 files changed, 16 insertions, 12 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)); } diff --git a/src/platform/posix/posix_resolv_gai.c b/src/platform/posix/posix_resolv_gai.c index 1c56778e..b4d63b59 100644 --- a/src/platform/posix/posix_resolv_gai.c +++ b/src/platform/posix/posix_resolv_gai.c @@ -34,15 +34,15 @@ // changed with this define. Note that some platforms may not have a // thread-safe getaddrinfo(). In that case they should set this to 1. -#ifndef NNG_POSIX_RESOLV_CONCURRENCY -#define NNG_POSIX_RESOLV_CONCURRENCY 4 +#ifndef NNG_RESOLV_CONCURRENCY +#define NNG_RESOLV_CONCURRENCY 4 #endif static nni_mtx resolv_mtx; static nni_cv resolv_cv; static bool resolv_fini; static nni_list resolv_aios; -static nni_thr resolv_thrs[NNG_POSIX_RESOLV_CONCURRENCY]; +static nni_thr resolv_thrs[NNG_RESOLV_CONCURRENCY]; typedef struct resolv_item resolv_item; struct resolv_item { @@ -383,14 +383,14 @@ nni_posix_resolv_sysinit(void) resolv_fini = false; - for (int i = 0; i < NNG_POSIX_RESOLV_CONCURRENCY; i++) { + for (int i = 0; i < NNG_RESOLV_CONCURRENCY; i++) { int rv = nni_thr_init(&resolv_thrs[i], resolv_worker, NULL); if (rv != 0) { nni_posix_resolv_sysfini(); return (rv); } } - for (int i = 0; i < NNG_POSIX_RESOLV_CONCURRENCY; i++) { + for (int i = 0; i < NNG_RESOLV_CONCURRENCY; i++) { nni_thr_run(&resolv_thrs[i]); } @@ -405,7 +405,7 @@ nni_posix_resolv_sysfini(void) nni_cv_wake(&resolv_cv); nni_mtx_unlock(&resolv_mtx); - for (int i = 0; i < NNG_POSIX_RESOLV_CONCURRENCY; i++) { + for (int i = 0; i < NNG_RESOLV_CONCURRENCY; i++) { nni_thr_fini(&resolv_thrs[i]); } nni_cv_fini(&resolv_cv); diff --git a/src/platform/windows/win_resolv.c b/src/platform/windows/win_resolv.c index aca07ecb..d361a1e8 100644 --- a/src/platform/windows/win_resolv.c +++ b/src/platform/windows/win_resolv.c @@ -22,15 +22,15 @@ // host file, WINS, or other naming services. As a result, we just build // our own limited asynchronous resolver with threads. -#ifndef NNG_WIN_RESOLV_CONCURRENCY -#define NNG_WIN_RESOLV_CONCURRENCY 4 +#ifndef NNG_RESOLV_CONCURRENCY +#define NNG_RESOLV_CONCURRENCY 4 #endif static nni_mtx resolv_mtx; static nni_cv resolv_cv; static bool resolv_fini; static nni_list resolv_aios; -static nni_thr resolv_thrs[NNG_WIN_RESOLV_CONCURRENCY]; +static nni_thr resolv_thrs[NNG_RESOLV_CONCURRENCY]; typedef struct resolv_item resolv_item; struct resolv_item { @@ -355,14 +355,14 @@ nni_win_resolv_sysinit(void) nni_aio_list_init(&resolv_aios); resolv_fini = false; - for (int i = 0; i < NNG_WIN_RESOLV_CONCURRENCY; i++) { + for (int i = 0; i < NNG_RESOLV_CONCURRENCY; i++) { int rv = nni_thr_init(&resolv_thrs[i], resolv_worker, NULL); if (rv != 0) { nni_win_resolv_sysfini(); return (rv); } } - for (int i = 0; i < NNG_WIN_RESOLV_CONCURRENCY; i++) { + for (int i = 0; i < NNG_RESOLV_CONCURRENCY; i++) { nni_thr_run(&resolv_thrs[i]); } return (0); @@ -375,7 +375,7 @@ nni_win_resolv_sysfini(void) resolv_fini = true; nni_cv_wake(&resolv_cv); nni_mtx_unlock(&resolv_mtx); - for (int i = 0; i < NNG_WIN_RESOLV_CONCURRENCY; i++) { + for (int i = 0; i < NNG_RESOLV_CONCURRENCY; i++) { nni_thr_fini(&resolv_thrs[i]); } nni_cv_fini(&resolv_cv); |
