From 36d8e972231c397194e513691d09f7d489de0a62 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 16 Feb 2015 22:25:50 -0500 Subject: make pthread_exit responsible for disabling cancellation this requirement is tucked away in XSH 2.9.5 Thread Cancellation under the heading Thread Cancellation Cleanup Handlers. --- src/thread/pthread_cancel.c | 3 --- src/thread/pthread_create.c | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/thread/pthread_cancel.c b/src/thread/pthread_cancel.c index f17ce882..4493931e 100644 --- a/src/thread/pthread_cancel.c +++ b/src/thread/pthread_cancel.c @@ -3,9 +3,6 @@ void __cancel() { - pthread_t self = __pthread_self(); - self->canceldisable = 1; - self->cancelasync = 0; pthread_exit(PTHREAD_CANCELED); } diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index 64971d56..b6a7a5ef 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -23,6 +23,8 @@ _Noreturn void __pthread_exit(void *result) pthread_t self = __pthread_self(); sigset_t set; + self->canceldisable = 1; + self->cancelasync = 0; self->result = result; while (self->cancelbuf) { -- cgit v1.2.1