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

Jason Merrill jason at redhat.com
Wed Jul 13 15:39:42 UTC 2005


On Wed, 13 Jul 2005 17:28:50 +0200, Alexander Terekhov <terekhov at web.de> wrote:

> Jason Merrill wrote:
> [...]
>> while (true)
>>  try
>>   {
>>    body();
>>   }
>>  catch (...)
>>   {
>>    recover();
>>   }
>> 
>> Under the old non-EH implementation this thread cancelled properly.  
>
> You mean with omitted recovery? That's hardly "properly".
>
> Cancel-unaware code is not meant to be canceled. 
>
> It's as simply as that.

A customer of ours has code along those lines in a package that uses
pthread_cleanup_push/pop to handle cleanups on cancellation.  It works fine
under Solaris, tru64, and older linux systems.

It IS cancel-aware.  The problem is that allowing catch(...) to catch
cancellation changes what it MEANS to be cancel-aware in an incompatible
way.

Jason



More information about the c++-pthreads mailing list