2009/8/7 Igor R
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