There are two ways, as I knew, one of them is to create std :: thread by lambda.
std::thread run_thread([&]{ m_io_service.run(); });
Another is to create boost :: thread with boost :: bind
boost::thread run_thread(boost::bind(&boost::asio::io_service::run, boost::ref(m_io_service)));
source
share