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
- To: Wil Evers <wil@xxxxxxxxxxxxxx>
- Subject: Re: [c++-pthreads] Re: thread-safety definition
- From: Ted Baker <baker@xxxxxxxxxx>
- Date: Mon, 12 Jan 2004 06:35:34 -0500
> 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