]> sourceware.org Git - glibc.git/commit
nptl: Remove CANCELING_BITMASK
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 25 May 2021 17:31:30 +0000 (14:31 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 9 Jun 2021 18:16:45 +0000 (15:16 -0300)
commit26cfbb7162ad364d53d69f6d482f2d87b5950524
tree5e5bf4bafe92016bb5a520e5069b3e6e712d6e80
parent41c72956179a8ed730d1ac8198015934398fe72b
nptl: Remove CANCELING_BITMASK

The CANCELING_BITMASK is used as an optimization to avoid sending
the signal when pthread_cancel is called in a concurrent manner.

This requires then to put both the cancellation state and type on a
shared state (cancelhandling), since 'pthread_cancel' checks whether
cancellation is enabled and asynchrnous to either cancel itself of
 sending the signal.

It also requires handle the CANCELING_BITMASK on
__pthread_disable_asynccancel, however this incurs in the same issues
described on BZ#12683: the cancellation is acted upon even *after*
syscall returns with user visible side-effects.

This patch removes this optimization and simplifies the pthread
cancellation implementation: pthread_cancel now first checks if
cancellation is already pending and if not always, sends a signal
if the target is not itself.  The SIGCANCEL handler is also simpified
since there is not need to setup a CAS loop.

It also allows to move both the cancellation state and mode out of
'cancelhadling' (it is done in subsequent patches).

Checked on x86_64-linux-gnu and aarch64-linux-gnu.
nptl/cancellation.c
nptl/descr.h
nptl/pthread_cancel.c
nptl/pthread_join_common.c
This page took 0.044309 seconds and 5 git commands to generate.