From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-12-28 17:07:50


Hi Andrew,

--- Andrew Schweitzer <a.schweitzer.grps_at_[hidden]> wrote:
> Oh... wait... the timer *is* queued, I think, in the
> IoCompletionPort queue... so it looks like in asio it would be
> possible to cancel the timer and still have the timer
> execute... right? If so is there anyway to detect this is
> happening (other than the bound arguments?)

Maybe I should just wait and let you answer your own questions
;)

See this page for example:

<http://asio.sourceforge.net/boost-asio-proposal-0.3.6/libs/asio/doc/reference/deadline_timer_reset.html>

Basically if the timer was cancelled successfully, the timer's
cancel() function returns non-zero and the handler is called
with the operation_aborted error.

If you were too late to cancel the timer (e.g. it is already on
the I/O completion port queue but not delivered) then cancel()
returns 0, and when the handler is finally called it will have
the success error code.

Cheers,
Chris