c++ – boost.asio using io_context.poll_one to perform a single task that may get suspended
My application spawns boost.asio job, which at some point, execute background task and get suspended.
I’m running this job using io_context_ with the method poll_one.
However, once it gets suspended I don’t see the rest of the job being executed…
Is this expected ? Do suspended jobs, go out of the queue and re-inserted again as a new jobs, which require additional poll_one to complete ?
For example, am I expected to see the second print message in this program.
boost::asio::spawn(io_context_, [](const boost::asio::yield_context &yield) {
print("do stuff");
io_task(yield);
print("do more stuff");
}
io_context_.poll_one();
Thanks
Read more here: Source link
