From aecda35373511c5bf02c0f708bd262adb1a09287 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 4 Feb 2016 22:59:13 +0000 Subject: avoid using signals when a thread attempts to cancel itself not only is pthread_kill expensive in this case; it also breaks testing under qemu app-level emulation. --- src/thread/pthread_cancel.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/thread/pthread_cancel.c b/src/thread/pthread_cancel.c index a21c3866..3d229223 100644 --- a/src/thread/pthread_cancel.c +++ b/src/thread/pthread_cancel.c @@ -92,5 +92,6 @@ int pthread_cancel(pthread_t t) init = 1; } a_store(&t->cancel, 1); + if (t == pthread_self() && !t->cancelasync) return 0; return pthread_kill(t, SIGCANCEL); } -- cgit v1.2.1