[c++-pthreads] Re: pthread_cancel and EH: let's try this again
Mark Mitchell
mark at codesourcery.com
Fri Jul 15 21:03:11 UTC 2005
Jason Merrill wrote:
> On Fri, 15 Jul 2005 00:53:40 -0700, Mark Mitchell <mark at codesourcery.com> wrote:
>
>
>>The whole point of destructors and exceptions in C++ is that you are
>>guaranteed that all exits from a block will result in a particular set
>>of cleanup code -- including both destructors and the bodies of catch
>>clauses -- being run in a particular order.
>
>
> Not all exits. A return, break or goto from within a try block skips catch
> clauses.
True, as does falling off the end of the try block.
However, the point remains; people put cleanup code in "catch (...)" blocks.
In fact, that approach works fine with cancellation on current GNU/Linux
systems, so long as you re-throw at the end of the catch clause -- and
#2 would break that body of code.
--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
(916) 791-8304
More information about the c++-pthreads
mailing list