[PATCH v2 5/9] nptl: Move cancel state out of cancelhandling

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Jun 2 13:09:49 GMT 2021



On 01/06/2021 06:58, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
> 
>> Now that thread cancellation state is not accessed concurrently anymore,
>> it is possible to move it out the 'cancelhandling'.
>>
>> The code is also simplified: the CANCELLATION_P is replaced with a
> 
> Drop “the”?

Ack.

> 
>> internal pthread_testcancel call and the CANCELSTATE_BIT{MASK} is
>> removed.
>>
>> The second part of this patchset also keeps the pthread_setcanceltype as
>> cancellation entrypoint by calling pthread_testcancel if the new type
>> is PTHREAD_CANCEL_ASYNCHRONOUS.
> 
> What do you mean by “patchset” in this context?  It's in the same
> commit, right?

I did not update this comment with recent rebase.  I will just remove 
this paragraph.

> 
>> With this behavior pthread_setcancelstate does not require to act on
>> cancellation if cancel type is asynchronous (is already handled either
>> by pthread_setcanceltype or by the signal handler).
> 
> Is this really true?  What is supposed to happen with a pending
> asynchronous cancellation request if cancellation is disabled for the
> target thread?  Isn't it supposed to be queued if it's a self-cancel?

POSIX does not really define pthread_setcancelstate as a cancellation
entrypoint [1].  And the pthread_cancel already queue the cancellation
by setting the CANCELED_BITMASK, the cancellation will be acted upon
on next cancellation entrypoint when cancellation is enabled.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html


More information about the Libc-alpha mailing list