18 Oct
2006
18 Oct
'06
10:26 p.m.
Hi Sascha,
I have a question regarding changing the number of threads:
sometimes I need to explicitly kill all worker threads. therefor I set the number of threads to zero using pool::resize(0) and wait for all
[...] since we did not add a task all worker threads are still running
(waiting for some work to do). they will be killed as soon as we schedule some tasks. well, this isn't to bad at the first look.
I regard this at least as a undesireable behaviour ;-) You may believe it or not: I stumbled about this problem some days ago while refactoring the code (it's not yet commited to CVS). A fast fix is to notify m_task_is_available right after m_thread_is_idle.notify_all(); in the resize method. Best regards, Philipp