Hi,
In my code I create a thread pool with only one thread, and then push all the functions that I want to execute. After that, while the functions are being executed by that thread, I use another thread (that doesn't belong to the thread pool) to increase the number of threads in the thread pool, using the resize method. However, the resizing has no effect since the new threads I added do not execute anything, only the first thread (thread 0) executes the functions that are still in the queue.
Does this happen because when I push the functions they are automatically associated with a thread? And in my case, since when I push the functions there is only thread 0 in the thread pool, all functions become associated with that thread?
Also, is there a problem in calling resize from a function outside the thread pool?
Thank you in advance for your help!
Hi,
In my code I create a thread pool with only one thread, and then
pushall the functions that I want to execute. After that, while the functions are being executed by that thread, I use another thread (that doesn't belong to the thread pool) to increase the number of threads in the thread pool, using theresizemethod. However, the resizing has no effect since the new threads I added do not execute anything, only the first thread (thread 0) executes the functions that are still in the queue.Does this happen because when I
pushthe functions they are automatically associated with a thread? And in my case, since when Ipushthe functions there is onlythread 0in the thread pool, all functions become associated with that thread?Also, is there a problem in calling
resizefrom a function outside the thread pool?Thank you in advance for your help!