From: Rich Felker Date: Thu, 4 Feb 2016 22:59:13 +0000 (+0000) Subject: avoid using signals when a thread attempts to cancel itself X-Git-Tag: v1.1.13~8 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=aecda35373511c5bf02c0f708bd262adb1a09287;p=oweals%2Fmusl.git 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. --- 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); }