threadpool is a cross-platform C++ thread pool library based on Boost. The threadpool library provides a convenient way for dispatching asynchronous tasks. Pools can be customized, managed dynamically and easily integrated into your software. The library is used by several commercial server applicaions and an handle high work load without problems.
using namespace boost::threadpool;
// Create prioritized thread pool container without any threads.
scoped_pool<prio_pool, 0> tp;
// Add some tasks to the pool.
tp += prio_task_func(5, &normal_task);
tp += prio_task_func(100, &important_task);
tp += prio_task_func(7, &normal_task);
// Add the some threads to the pool. This will start the execution of the tasks.
// The tasks are processed according to their priority:
// important_task(100), nonrelevant_task(7), nonrelevant_task(5).
// Now all tasks are finished and the pool will be destroyed safely when tp goes out of scope.
Quite simple implementation based on lib_pthread. You can base your code on it and it's very likely some further modification is required. As is introduced in its homepage, it's:
"An implementation of a thread-pool based on POSIX-threads. It builds a pool of p threads which are blocked until a job was given to the pool. Then an idle thread is chosen and the job is executed at this thread. If no idle thread is available, the pool blocks until one of the running jobs terminates."
It's an ambitious project that aims to bring C++ to the world of web development. As is stated in it's introduction page:
"The framework is developed for rapid development of Enterprise application on the C++ platform. It is a c++ web framework, c++ application framework, c++ rest framework and c++ soap framework all bundled into one. It consists of the following and is currently implemented for LINUX/WINDOWS(Cygwin). It is the first and only C++ Application framework to provide non-intrusive Dependency Injection and Business Driven Component Logic and POCO based Development. Most of the features are controlled by configuration files."
poco c++ libraries
Poco is a framework written in modern, standard ansi C++ using C++ standard library. The framework seems perfectly complete(compression, data access, ssl, crypto, xml, threading, ipc - Anything you could think of in application development, it incudes.) It uses Boost license, and seems has lots of users.
Supprisingly, Windows provides API for thread-pool management.And they have two sets of them. There was one shipped with Windows XP, and then in Windows Vista they upgrade the API by providing the second set.
If you are planning to use a thread-pool along with curl. The answer is, you don't need a thread-pool! This function provides all what you need. With asynchronous socket you can handle many connections with one thread, and curl has perfect support for this. It's fast, robust and handy.
Now smile :)