I am currently writing a simple server using Boost.Asio 1.68 and I am wondering if there is a way for me to add a handler that is executed when the event loop has no other work to do.
Currently I have this:
void completionHandler (boost::asio::io_context* ioCtx){
// poll for some condition
// if (condition) do some work;
ioCtx->post(boost::bind(completionHandler, ioCtx));
}
//elsewhere
ioCtx->post(boost::bind(completionHandler, ioCtx));
However, this doesn't exactly match what I want to do.
Aucun commentaire:
Enregistrer un commentaire