Boost logo

Boost Users :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2007-06-12 18:59:10


Matthew Edwards wrote:
> In my tests, I will resolve an invalid domain (this
> causes the resolve to take a few seconds, to demonstrate the problem),
> sleep for 100ms, then call cancel on the resolver object. No cancelling
> actually occurs, and the callback is simply triggered after a few seconds
> with a "No host found" error code, not the expected operation aborted.
>
> Has anyone experienced this before, or know how I
> might be using the resolver incorrectly?

It's behaving correctly according to the design of the implementation. If
the resolve operation you're trying to cancel is the currently executing one
on the hidden thread it waits for it to finish. It's only able to cancel
queued resolve operations immediately.

In general, cancellation is only a best effort thing. Strictly speaking it only
really guarantees that the operation will not be indefinite. You may not be able
to cancel all operations because they may have already entered an un-cancellable
state, but they will finish within some bounded period of time.

Cheers,
Chris


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