[c++-pthreads] Re: thread-safety definition
Ted Baker
baker at cs.fsu.edu
Mon Jan 12 11:35:34 UTC 2004
> Please note that the example destructor above is also called on a
> regular (non-exceptional) exit from the block in which the
> remote_resource_holder lives.
>
> Since, in that case, there is no exception 'in flight', a cancellation
> exception thrown from remote_source->release() *will* be discarded,
There can be no cancellation exception thrown in this case,
because cancellation is disabled during the destructor
execution. (This what is required in Ada, by the way.)
> unless - in *all* such destructors - the code is changed to explictly
> disable cancellation.
Yes. You must diable cancellation in *all* destructors.
> In other words, non-sticky cancellation will break existing code, and
> the replacement code will not be pretty. IMHO, this is highly
> undesirable - writing robust destructors is hard enough without these
> complications.
Disabling cancellation in all destructors can be done automagically
by the compiler, so it will not break existing code. The code will
only need to be recompiled.
--Ted
More information about the c++-pthreads
mailing list