调用deadline_timer::wait
会导致io_service
内的其他任务在等待时执行,还是在内部调用后完全阻止io线程?
io_service service;
io_service::work work(service);
thread thread([&] { service.run() });
service.post([&]
{
deadline_timer timer(service, posix_time::seconds(100000);
timer.wait();
});
service.post([&]
{
std::cout << "HELLO!";
}):
thread.join();
你好打印吗?