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: Jason Merrill <jason@xxxxxxxxxx>
- Date: Mon, 12 Jan 2004 13:26:28 -0500
On Sun, 11 Jan 2004 22:03:58 +0100, Wil Evers <wil@xxxxxxxxxxxxxx> wrote:
> Jason Merrill wrote:
>> I agree that cancellation should be sticky, and it is in my model as well
>> as Nathan's. But I don't think that this particular example would discard
>> cancellation exceptions.
>
> I think it will. Even if cancellation is disabled while exceptions are in
> flight, a 'catch-everything-and-never-rethrow' block in a destructor will
> discard a cancellation exception when that destructor is triggered by a
> regular (non-exceptional, non-unwinding) exit from a block scope.
True.
> Call me paranoid, but as a C++ programmer, the thing that scares me most in
> the discussions on this list is a certain (perceived?) pressure to open the
> door for letting exceptions escape from destructors.
I don't think anyone is advocating that. I can see how you could infer
that from general opposition to catch(...) { }, but destructors are a
situation where it is appropriate, as the alternative is terminate().
This is why I want the cancel to return to pending status if the exception
is destroyed--so that exception-safety code like this doesn't result in the
unexpected loss of a cancel.
Jason