aboutsummaryrefslogtreecommitdiff
path: root/nptl/pthread_testcancel.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/pthread_testcancel.c')
-rw-r--r--nptl/pthread_testcancel.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/nptl/pthread_testcancel.c b/nptl/pthread_testcancel.c
index a9e941d..9203746 100644
--- a/nptl/pthread_testcancel.c
+++ b/nptl/pthread_testcancel.c
@@ -23,7 +23,16 @@
void
___pthread_testcancel (void)
{
- CANCELLATION_P (THREAD_SELF);
+ struct pthread *self = THREAD_SELF;
+ int cancelhandling = THREAD_GETMEM (self, cancelhandling);
+ if (self->cancelstate == PTHREAD_CANCEL_ENABLE
+ && (cancelhandling & CANCELED_BITMASK)
+ && !(cancelhandling & EXITING_BITMASK)
+ && !(cancelhandling & TERMINATED_BITMASK))
+ {
+ THREAD_SETMEM (self, result, PTHREAD_CANCELED);
+ __do_cancel ();
+ }
}
versioned_symbol (libc, ___pthread_testcancel, pthread_testcancel, GLIBC_2_34);
versioned_symbol (libc, ___pthread_testcancel, __pthread_testcancel,