Boost logo

Boost :

From: Moore, Dave (dmoore_at_[hidden])
Date: 2002-03-21 12:36:07

An implementation of a thread_pool (aka worker pool, worker queue) has been
uploaded to :

Documentation and examples are included.


- Implemented purely in terms of Boost.Threads
- A thread pool object can execute any function conforming to
- Control over the minimum and maximum number of threads used in the pool
- thread_pool is join()able
- cancel is provided, which currently cancels any unexecuted jobs, and will
eventually cancel any running jobs once boost::thread::cancel() exists.

Future Directions/Questions:

- It may be a good idea to support priorities for jobs, but this should be
done in concert with the idea of boost::thread::priority

- While detach() is included in the sample implementation for completeness,
it may not be necessary for a thread_pool. If the risks outweigh the
utility, it may be removed.


Requires Boost 1.27.0. On win32, a deadlock can occur when adding new
functions to the thread pool for Boost 1.26.0

Thanks very much to Bill Kempf for EXTENSIVE feedback and comments on the


Boost list run by bdawes at, gregod at, cpdaniel at, john at