[c++-pthreads] Re: pthread_cancel and EH: let's try this again

George Shimanovich gshiman at commvault.com
Fri Jul 15 21:16:26 UTC 2005



-----Original Message-----
From: Mark Mitchell [mailto:mark at codesourcery.com] 
Sent: Friday, July 15, 2005 5:03 PM
To: Jason Merrill
Cc: Jakub Jelinek; Gabriel Dos Reis; c++-pthreads at codesourcery.com
Subject: Re: [c++-pthreads] Re: pthread_cancel and EH: let's try this
again

Mark Mitchell wrote:
>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.
According to my colleges and mine experience using pthread in GNU/Linux
entire program crashes when thread is cancelled due to abort() or
cancelled thread hangs in system space. That is collaborated by this
quote from Jason:
	>And the current status quo in GCC: 
	>(3) #1, except that the destructor for the exception calls
abort())

George Shimanovich
CommVault Systems, Inc.




More information about the c++-pthreads mailing list