mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
nptl: Move cancel state out of cancelhandling
Now that thread cancellation state is not accessed concurrently anymore, it is possible to move it out the 'cancelhandling'. The code is also simplified: CANCELLATION_P is replaced with a internal pthread_testcancel call and the CANCELSTATE_BIT{MASK} is removed. 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). Checked on x86_64-linux-gnu and aarch64-linux-gnu.
This commit is contained in:
@@ -59,7 +59,10 @@ __pthread_clockjoin_ex (pthread_t threadid, void **thread_return,
|
||||
&& (pd->cancelhandling
|
||||
& (CANCELED_BITMASK | EXITING_BITMASK
|
||||
| TERMINATED_BITMASK)) == 0))
|
||||
&& !CANCEL_ENABLED_AND_CANCELED (self->cancelhandling))
|
||||
&& !(self->cancelstate == PTHREAD_CANCEL_ENABLE
|
||||
&& (pd->cancelhandling & (CANCELED_BITMASK | EXITING_BITMASK
|
||||
| TERMINATED_BITMASK))
|
||||
== CANCELED_BITMASK))
|
||||
/* This is a deadlock situation. The threads are waiting for each
|
||||
other to finish. Note that this is a "may" error. To be 100%
|
||||
sure we catch this error we would have to lock the data
|
||||
|
Reference in New Issue
Block a user