make pthread_exit responsible for disabling cancellation
authorRich Felker <dalias@aerifal.cx>
Tue, 17 Feb 2015 03:25:50 +0000 (22:25 -0500)
committerRich Felker <dalias@aerifal.cx>
Tue, 17 Feb 2015 03:25:50 +0000 (22:25 -0500)
this requirement is tucked away in XSH 2.9.5 Thread Cancellation under
the heading Thread Cancellation Cleanup Handlers.

src/thread/pthread_cancel.c
src/thread/pthread_create.c

index f17ce882cfdbbe55618a4cba24dc23142cc04eea..4493931e582dfe7237e0c1c300664ed3b17e4ed5 100644 (file)
@@ -3,9 +3,6 @@
 
 void __cancel()
 {
-       pthread_t self = __pthread_self();
-       self->canceldisable = 1;
-       self->cancelasync = 0;
        pthread_exit(PTHREAD_CANCELED);
 }
 
index 64971d569e5391bfce5566c2140ccf8cd3e48e7d..b6a7a5ef06ad72ac79d25bea5b3ac6454274426c 100644 (file)
@@ -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) {