Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost-users Digest, Vol 2933, Issue 5
From: Marat Abrarov (abrarov_at_[hidden])
Date: 2011-12-13 02:38:16


Hi, Rory.

> Is there a reason io_service::run does not set an appropriate error on the
> passed boost::system::error_code object when this is encountered? Certainly
> it seems like an error case and would help circuital circumstances such as
> my own.

With current behavior of asio::io_service we can continue working with io_service after it was stopped by calling
asio::io_service::reset(). It's like pause on io_service. It's not often used feature but it is nice to know that such
behavior is possible.

Also note that invocation of handlers is done only within threads that executes asio::io_service::run (run_one, poll,
poll_one - http://www.boost.org/doc/libs/1_48_0/doc/html/boost_asio/overview/core/threads.html).
When io_service switches to the "stopped" state asio::io_service::run have to exit as fast as possible.
When io_service is already in the "stopped" state asio::io_service::run have to exit immediately.
So if io_service is already in stopped state before any user thread calls asio::io_service::run how can Asio pass
"appropriate error" to asynchronous completion handlers?

IMHO, current design of Asio is very clear.

Regards,
Marat Abrarov.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net