Search code examples
c++boostboost-asio

Is it guaranteed that handler of async_* in boost::asio will be always called?


I call boost::asio::serial_port::async_write_some() and asio::io_service::run() in the other thread. There is a callback given to "async_write_some". Can I safely assume, that this callback will be eventually called (possibly with some error code)? Under what circumstances it's not true?


Solution

  • Can I safely assume, that this callback will be eventually called (possibly with some error code)?

    I think no.

    Under what circumstances it's not true?

    The io_service::stop method is called before data is sent.