This question refers to boost::threadpool::pool
, and there's docs about it here on sourceforge , but I can't find it in the boost docs .
Why is it called boost if it's not on boost?
PS: I know how to use Boost::ASIO's io_service
to create a thread pool, but I'd like to understand what this boost::threadpool
is.
As a former helper with Boost.Thread maintenance, I was often asked why Boost.Thread doesn't provide a thread pool. The simple answer is that it really is too easy to roll your own, for example here is a perfectly fine threadpool implementation in only a few lines of C++ .
It's too small a thing for Boost, and too much bike shedding would happen on trying to submit a general purpose thread pool. So you can misuse ASIO to implement a thread pool (also easy), roll your own, or just use the thread pool in the C++ 11 standard library accessible via std::async
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.