summaryrefslogtreecommitdiff
path: root/src/thread
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016-02-04 22:59:13 +0000
committerRich Felker <dalias@aerifal.cx>2016-02-04 22:59:13 +0000
commitaecda35373511c5bf02c0f708bd262adb1a09287 (patch)
tree932c08f2e997eaebd6ed0667700b8c63041fb6f7 /src/thread
parent47314f1e6780bd561151c3241d4bcf7b861ed3ee (diff)
downloadmusl-aecda35373511c5bf02c0f708bd262adb1a09287.tar.gz
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.
Diffstat (limited to 'src/thread')
-rw-r--r--src/thread/pthread_cancel.c1
1 files changed, 1 insertions, 0 deletions
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);
}