Reputation: 21966
I'm trying to use a boost timer to do some operations asynchronously:
boost::asio::io_service io;
boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
t.async_wait(timer_func);
io.run();
The problem is that io.run() is a blocking call. I would like to have an asynchronous timer that doesn't block the main thread, and then calls the callback on the main thread. Is this possible with boost?
Upvotes: 0
Views: 403
Reputation: 2453
The io_service::poll
doesn't block. You'll have though to implement some looping logic around it.
Upvotes: 1