C-Thread-Pool
C-Thread-Pool copied to clipboard
question about threads_keepalive variable.
Hi, thanks for this awesome lib.
In thpool.c (line 37), here is static volatile int threads_keepalive; , why not put threads_keepalive on struct thpool_?
Assume the following scenario:
- Create thread pool A (Now
threads_keepaliveis set to 1); - Call
add_taskon thread pool A; - Create thread pool B (Now
threads_keepaliveis set to 1); - Call
add_taskon thread pool B; - Destroy thread pool A (Now
threads_keepaliveis set to 0); - Call
add_taskon thread pool B ; ( task won't execute, because ofthreads_keepalive == 0)
Just stumbled with similar issue. In my application, thread pool B isn't scheduling tasks if thread pool A is destroyed.