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

Peter Dimov pdimov at mmltd.net
Wed Jul 27 20:01:24 UTC 2005


Alexander Terekhov wrote:
> Peter Dimov wrote:
> [...]
>> int pthread_cancelenabled(void);
>>
>> RETURN VALUE
>>
>> Nonzero if the current thread's cancelability state is
>> PTHREAD_CANCEL_ENABLE and the call is not made from within a cleanup
>> handler or a TSD destructor,
>                                ^^^^^^^^^^^^^^^^^^^^^^^^
>> zero otherwise.
>>
>> could have been much simpler.
>
> With cancel request pending, mandatory cancel points are required to
> throw within a cleanup handler invoked by pthread_cleanup_pop() ["(if
> /execute/ is non-zero)"] when cancel state is PTHREAD_CANCEL_ENABLE.

An odd requirement that could've been given the appropriate attention had 
something like the above been proposed. ;-)

The specification of the hypothetical pthread_cancelenabled can be "fixed" 
to match this behavior, but I'm not sure that this is desirable. If you have 
two calls to 'close' in the cleanup handler and the first is canceled, the 
second will be skipped. 




More information about the c++-pthreads mailing list