c++ - boost.asio tcp sockets, Will asynchronous operations be ordered? -
If calling: asio :: async_write / async_read directly after each other, what data will be ordered? Or do I need to wait on the callback before I make a call?
Thank you in advance!
The order of the data is not guaranteed and if you want to re-write the callback before those functions are using it. In the context of async_write , async_read also applies)
Because async_write Has been implemented in the context of several calls for the async_write_some function of the built-in stream, those calls are not atoms, attempts to write data to each call stream and internal callback to deal with partial operations To wait effectively, you can code yourself, then you can Distributed data can easily finish if you do not wait for completion.
You have to consider threads. If you call async_x on a stream several times, you can eliminate concurrent actions on the same built-in stream in different threads, which can cause undefined behavior.
Comments
Post a Comment