nng
nng copied to clipboard
Define NNG_EXPIRE_THREADS not set in CMakeLists.txt
The define NNG_EXPIRE_THREADS not set in CMakeLists.txt. Define is used in nni_aio_sys_init().
Fix in CMakeLists.txt:
if (NNG_EXPIRE_THREADS) add_definitions(-DNNG_EXPIRE_THREADS=${NNG_EXPIRE_THREADS}) endif () mark_as_advanced(NNG_EXPIRE_THREADS)
so what does this patch help?
so what does this patch help?
Related to "nng creates a massive amount of threads on high core count machines" https://github.com/nanomsg/nng/issues/1572:
Yes, it would be good to have this as a tunable in the CMakeLists.
@gdamore at the end only the NNG_MAX_EXPIRE_THREADS was added. Code still uses NNG_EXPIRE_THREADS that effectively overrides NNG_MAX_EXPIRE_THREADS.
Should we apply something similar to how taskq limits are set?
Having a max value (NNG_MAX_EXPIRE_THREADS
) that only caps the number of tasks, default to 8 or 256 (CMake default is 8 today but code imposes 256 limit).
And having a NNG_NUM_EXPIRE_THREADS
that overrides the value, but still obeys the limit?
I have an MR for that if you want.
Go ahead and submit the PR. Cannot promise it will merge, but it might, and cannot hurt to look.
The taskqs needs to have a minimum of 2, or else deadlocks may occur.