Boost logo

Boost Users :

Subject: Re: [Boost-users] ASIO cancel question
From: Roman Shmelev (rshmelev_at_[hidden])
Date: 2009-08-07 09:00:42


2009/8/7 Igor R <boost.lists_at_[hidden]>:
> 1, 2) IIRC, the answer is no - i.e. even if your io_service is running
> in a single thread, you can't be sure that an attempt to cancel i/o
> operation or timer will really have any effect, because the operation
> can already be complete so that cancellation won't affect it, and even
> more than that -- its handler can already be in the queue. I remember
> there is a discussion on this topic somewhere, but I can't find it at
> the moment.

Thank you for correcting me, Igor. I believe you are right :)
My logic was really simple:
1) async op completed. (And even) Handler put into queue.
2) cancel() called.
3) it's time to get our handler from queue and fire it
[4) why not check socket state and if it was cancelled then set error
code to corresponding value?]
5) fire the handler


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