How to create a thread pool using boost in C++?
问题 How do I create a thread pool using boost in C++, and how do I assign tasks to the threadpool? 回答1: The process is pretty simple. First create an asio::io_service and a thread_group. Fill the thread_group with threads linked to the io_service. Assign tasks to the threads using the boost::bind function. To stop the threads (usually when you are exiting your program) just stop the io_service and join all threads. You should only need these headers: #include <boost/asio/io_service.hpp> #include