From 26cfbb7162ad364d53d69f6d482f2d87b5950524 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 25 May 2021 14:31:30 -0300 Subject: 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/descr.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'nptl/descr.h') diff --git a/nptl/descr.h b/nptl/descr.h index 9d8297b..a120365 100644 --- a/nptl/descr.h +++ b/nptl/descr.h @@ -283,9 +283,6 @@ struct pthread /* Bit set if asynchronous cancellation mode is selected. */ #define CANCELTYPE_BIT 1 #define CANCELTYPE_BITMASK (0x01 << CANCELTYPE_BIT) - /* Bit set if canceling has been initiated. */ -#define CANCELING_BIT 2 -#define CANCELING_BITMASK (0x01 << CANCELING_BIT) /* Bit set if canceled. */ #define CANCELED_BIT 3 #define CANCELED_BITMASK (0x01 << CANCELED_BIT) -- cgit v1.1