开发者

In boost::asio how do you add timeout to the service loop?

Totally new to Boost::asio, am an old Unix Select type guy...

Trying to get access to select/epo开发者_JAVA技巧ll like timeout feature to break out of the event loop. Adding a asio timer just calls my handler but does not allow me to break out of the service.run() loop. Don't want to delete the service just break out for a while and maybe restart it via service.run() later.

Along the same lines how do you remove a file descriptor from the service loop for a while, like EPOLL_CTL_DEL. Then add it back in later to be serviced again?

Thanks


call io_service.stop() from your deadline_timer handler, so io_service.run() will return control

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜