about summary refs log tree commit diff
path: root/src/thread/pthread_cancel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread/pthread_cancel.c')
-rw-r--r--src/thread/pthread_cancel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/thread/pthread_cancel.c b/src/thread/pthread_cancel.c
index 3d229223..bf07dbeb 100644
--- a/src/thread/pthread_cancel.c
+++ b/src/thread/pthread_cancel.c
@@ -92,6 +92,10 @@ int pthread_cancel(pthread_t t)
 		init = 1;
 	}
 	a_store(&t->cancel, 1);
-	if (t == pthread_self() && !t->cancelasync) return 0;
+	if (t == pthread_self()) {
+		if (t->canceldisable == PTHREAD_CANCEL_ENABLE && t->cancelasync)
+			pthread_exit(PTHREAD_CANCELED);
+		return 0;
+	}
 	return pthread_kill(t, SIGCANCEL);
 }