Boost logo

Boost Users :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-12-11 15:51:56


Boris Kolpackov wrote:
> Roland Schwarz <roland.schwarz_at_[hidden]> writes:
>> Full blown cancellation often is a too coarse grained tool anyways.
>
> I find this statement unsubstantiated. Can you elaborate a bit on this?

Full cancellation has to preserve invariants. I.e. you don't want to
leave any system or heap objects, behind. So cancellation has to clean
up properly. So it inevitably has to interact intimately with stack
unwinding, and exceptions.
Also cancellation is an all or nothing decision.

I often find my thread hanging in an input or waiting for some condition
which I simply want it to stop. Yes I regard this as an exceptional
thing, which I would like to be able to throw at the thread.

So when you can "alert" a thread which in turn ends waiting by means of
an exception, I can caught this in my code and do whatever is
appropriate. This might even be to attempt another input possibly by
acquiring a different resource, without even ending the thread.

Yes and I would like to be able to do this without explicit reference to
a global state from each and every call to wait, io, ...

For an example of how this could be done, see my alerter. (As far as I
remember the prototype is using broadcasts, since I tried to build it on
top of Boost.Thread. But I think this could be optimized.)

Hope this explains what I meant by "coarse grained".

Roland


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