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

Peter Dimov pdimov at mmltd.net
Wed Jul 20 22:14:27 UTC 2005


Alexander Terekhov wrote:
> Wil Evers wrote:

>> * A thread's cancellation state is only affected by calls to
>> pthread_setcancelstate() originating from user code.
>
> Intelligent cancel delivery aside for a moment, POSIX states:
>
> "When a cancellation request is acted upon, or when a thread calls
> pthread_exit(), the thread first disables cancellation by setting
> its cancelability state to PTHREAD_CANCEL_DISABLE and its
> cancelability type to PTHREAD_CANCEL_DEFERRED."

That's one of the few places where I think that we should not do what Posix 
says and just disable cancellation during unwinding instead. It has the same 
effect and solves the only real reported problem with the Tru64/OpenVMS 
model: that eating the cancellation exception leaves the thread running with 
cancelability disabled, causing the cancellation request to be lost without 
a trace. 




More information about the c++-pthreads mailing list