Boost logo

Boost Users :

From: Philipp Henkel (threadpool_at_[hidden])
Date: 2006-10-18 18:26:34


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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net