Suppose that when calling io_service :: run (), several async_read operations are scheduled (there may be other operations between them). What happens when an asynchronous operation, such as async_write, is scheduled in the ReadHandler function?
void handler(const boost::system::error_code& error, std::size_t bytes) {
async_write(sock, boost::asio::buffer(wbuf), whandler);
}
That is, when will async_write be called? I expect the execution order to be as follows:
1) async_read
2) async_write
3) async_read
4) async_write
Is this order of execution guaranteed?
source
share