我的问题是关于 boost asio 的 io_service。当我用那个方法调用它时:
int main()
{
try
{
boost::asio::io_service io_service;
Server server(io_service);
std::vector<boost::shared_ptr<boost::thread> > threads;
for (std::size_t i = 0; i < 16; ++i)
{
boost::shared_ptr<boost::thread> thread(new boost::thread(boost::bind(&boost::asio::io_service::run, &io_service)));
threads.push_back(thread);
}
for (std::size_t i = 0; i < threads.size(); ++i)
threads[i]->join();
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
}
return 0;
}
它会动态共享请求线程,还是只为连接组提供一个线程?谢谢。