Re: [c++-pthreads] Re: thread-safety definition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [c++-pthreads] Re: thread-safety definition



> ... It sounds as though a lot of people are seriously 
> considering the idea of allowing exceptions to escape from destructors.
> .... it is _absolutely vital_ 
> that destructors never be allowed to throw under any circumstances.

Right!  This is what we decided with Ada.  That is why
cancellation (task abort) is disabled during exception propagation
and finalization routines of controlled object (execution of
destructors).

This means we do not need to have any way to catch
cancellation/abort, that is, cancellation/abort is not allowed to
happen in the places where we otherwise would need to catch it.

> a destructor calls a function that may throw some unknown exception (a 
> very common case, especially in template classes whose destructors will 
> often call member functions of some arbitrary user-supplied type), the 
> call _must_ be wrapped in a catch-and-discard-all block. At most you 
> can log the error somewhere.
> 
> Any attempt to standardise a solution that doesn't take "Destructors 
> Must Not Throw" as axiomatic is simply going to be a non-starter as far 
> as C++ programmers are concerned. I'd really like to see this list 
> explicitly address this issue rather than continuing to casually talk 
> about uncatchable exceptions and similar horrors.
> 
> -- 
> Ross Smith ......... r-smith@xxxxxxxxxx ......... Auckland, New Zealand
> 
>     "This world is like a burnt steak: small, tough, and the chips
>     are always stacked against you." -- Mike

--Ted