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

George Shimanovich gshiman at commvault.com
Thu Jul 21 13:25:47 UTC 2005


Mark Mitchell wrote:
>That means that the most important question we should answer is what to

>do for the program above, when the "throw;" is removed.
>
>I think the only reasonable choices are:
>
>1) Fall off the end of the catch clause in the usual way, but the
thread 
>is still cancelled.  Encountering another cancellation point will
result 
>in re-raising the cancellation exception.
>
>2) Fall off the end of the catch clause in the usual way, but the
thread 
>is no longer cancelled.  It can be re-cancelled, but until it is, it 
>will operate normally.

There is one more problem with current catch(...)/throw implementation.
It may be beneficial in early stages of development NOT to use
catch(...) in order to generate coredumps at point of system crash.
Unwinding cancelled thread with C++ exception does not have that
problem. From application developer point of view the following seems
the best practical solution: C++ exception/throw/no throw - thread is
still cancelled. That is leaving aside stack unwinding and DTOR issues
of approach with C++ exceptions.

George Shimanovich
CommVault Systems



More information about the c++-pthreads mailing list