threadpool
0.2.5
threadpool is a cross-platform C++ thread pool library. In general terms thread pools are an efficient mechanism for asynchronous task processing within the same process. They realise the thread pool pattern.
A thread pool manages a group of threads in order to process a large number of tasks. Since multiple threads can be executed in parallel this approach may be very efficient regarding the overall program performance on many computer systems. By restricting the number of threads and by reusing them resources are saved and additionally the system stability is increased.
The threadpool library provides a convenient way for dispatching asynchronous tasks. Pools can be customized, managed dynamically and easily integrated into your software.
The threadpool core classes are completed and the implemenation can be considered ready for production code. The library is used by several commercial server applications and can handle high workload without problems. I'm currently working on helper and service classes which make the usage of the pool more comfortable. A small tutorial introduces the thread pool and more example code will be added in the future. The documentation is far away from being finished.
Browse CVS Repository
Features
- Policy-based thread pool implementation
- Scheduling policies: fifo, lifo and priority
- Size policies: static_size
- Size policy controller: empty_controller, resize_controller
- Shutdown policies: wait_for_all_tasks, wait_for_active_tasks, immediately
- Smooth integration into STL and boost
Future Work
- More policies: deadline_scheduler, ...
- Possibility of limiting the number of pending tasks
- Futures (handles to results of scheduled functions)
- More examples to illustrate the usage of the library
- Provide Unit tests
threadpool 0.2.5 (Stable)
For more information on the revisions see Change Log.
threadpool is highly portable. It runs on any platform on which Boost threads are available: Linux, Windows, Mac OS 9/X, Solaris, etc.
Boost is a collection of high-quality C++ libraries and works on almost any modern operating system, including UNIX and Windows variants. In fact threadpool is only a small extension to the portable Boost source libraries. It incorporates the thread pool concept by using the thread library from William Kempf. For more information on this excellent library visit Boost.org.
threadpool consists only of header files, and so there is no need to build the library itself before using it in your own applications. You simply need to add the following directories to your compiler include path:
- threadpool's include directory
- the boost directory (e.g. the one called boost_1_37_0)
Furthermore you have to compile boost's thread library and link against it (libboost_thread-*.lib under Windows).
threadpool is released under the Boost Software License. This license encourages both commercial and non-commercial use.
This library was written by Philipp Henkel.
I appreciate your suggestions, and would love to know if you use threadpool. Hopefully you will enjoy it and find it useful. Please post questions, comments, bugs, or contact me at:
threadpool@googlemail.com
or
www.sourceforge.net/projects/threadpool
Hosted by