Thursday, 15 August 2013

c++ - Does boost::asio::io_service need to be stopped to use it? -



c++ - Does boost::asio::io_service need to be stopped to use it? -

if have boost's ios service running in separate thread this:

boost::asio::io_service ios; boost::thread bt(boost::bind(&boost::asio::io_service::run, &ios));

is possible utilize socket or timer? or need stopped before passed these constructors?

boost::asio::deadline_timer dt1 = boost::asio::deadline_timer(ios);

yes, has running async io work - see this reply detailed explanation. problem io_service::run method returns when there no work , i/o thread may exit. standard solution create io_service::work instance before starting i/o thread. maybe catch exceptions in background thread prevent i/o loop termination.

c++ boost-asio

No comments:

Post a Comment