Boost logo

Boost :

From: Corrado Zoccolo (czoccolo_at_[hidden])
Date: 2007-09-16 06:25:46


My personal opinion on this is that the thread_interrupted exception
should be considered a normal exception.

My guideline to use exception vs. assertions is:
* if an invariant is broken, use assert
* if inputs are out of range, use exceptions, or better exit codes
* if the postcondition cannot be guaranteed due to a failure in the
interaction with external world, use exceptions

I think thread cancellation is an (asynchronous) interaction with
external world, so it should be handled exactly in the same way as a
timeout connecting to a TCP address, or an error when reading from
disk.

Moreover, I suggest that, instead of speaking of cancellation, in
which the outcome is decided from outside, we should speak of
interruption (like in Java, where thread handling was designed
together with the language).
Interruption is signalling a thread (that may be blocked into a long
operation) to become responsive again to some predefined events (one
of those, but not the only one, is termination).

Corrado

-- 
__________________________________________________________________________
dott. Corrado Zoccolo                          mailto:zoccolo_at_[hidden]
PhD - Department of Computer Science - University of Pisa, Italy
--------------------------------------------------------------------------
The self-confidence of a warrior is not the self-confidence of the average
man. The average man seeks certainty in the eyes of the onlooker and calls
that self-confidence. The warrior seeks impeccability in his own eyes and
calls that humbleness.
                               Tales of Power - C. Castaneda

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk