//g++ test_thread_pool.cpp -g -o test_thread_pool -std=c++11 -lboost_system -lboost_thread
#include <iostream>
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>
#include <boost/asio.hpp>
#include <boost/thread/detail/thread_group.hpp>
#include <boost/thread.hpp>
using namespace std;
using namespace boost;
class ThreadPool {
public:
ThreadPool(int num) : threadNum_(num), stopped_(false), work_(io_) {
for(int i=i; i<threadNum_; ++i) {
threads.create_thread(boost::bind(&asio::io_service::run, &io_));
}
}
~ThreadPool() {
stop();
}
template<typename F, typename...Args>
void post(F &&f, Args&&...args) {
io_.post(std::bind(