diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-03-31 15:43:25 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-06-09 15:16:45 -0300 |
commit | 2b5174253155bdace1262ea2ab53d11347ecdefd (patch) | |
tree | 9992336533dec0f8cd9579e217b7bc7a18d0733e /nptl/pthread_setcanceltype.c | |
parent | 26cfbb7162ad364d53d69f6d482f2d87b5950524 (diff) | |
download | glibc-2b5174253155bdace1262ea2ab53d11347ecdefd.tar.gz glibc-2b5174253155bdace1262ea2ab53d11347ecdefd.tar.xz glibc-2b5174253155bdace1262ea2ab53d11347ecdefd.zip |
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.
Diffstat (limited to 'nptl/pthread_setcanceltype.c')
-rw-r--r-- | nptl/pthread_setcanceltype.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/nptl/pthread_setcanceltype.c b/nptl/pthread_setcanceltype.c index 5f061d512b..ae5df1d591 100644 --- a/nptl/pthread_setcanceltype.c +++ b/nptl/pthread_setcanceltype.c @@ -53,7 +53,8 @@ __pthread_setcanceltype (int type, int *oldtype) oldval); if (__glibc_likely (curval == oldval)) { - if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval)) + if (self->cancelstate == PTHREAD_CANCEL_ENABLE + && CANCEL_CANCELED_AND_ASYNCHRONOUS (newval)) { THREAD_SETMEM (self, result, PTHREAD_CANCELED); __do_cancel (); |