summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_sig.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2010-09-19 09:03:11 +0000
committerdavidxu <davidxu@FreeBSD.org>2010-09-19 09:03:11 +0000
commitfe5567c8f172d8218fb37af60118825748628d44 (patch)
tree21699abe5fd839789147e1721b9b3cd97787d6c1 /lib/libthr/thread/thr_sig.c
parent5418a235978733112ea2f114b3826d95346409e8 (diff)
downloadFreeBSD-src-fe5567c8f172d8218fb37af60118825748628d44.zip
FreeBSD-src-fe5567c8f172d8218fb37af60118825748628d44.tar.gz
Because atfork lock is held while forking, a thread cancellation triggered
by atfork handler is unsafe, use intenal flag no_cancel to disable it.
Diffstat (limited to 'lib/libthr/thread/thr_sig.c')
-rw-r--r--lib/libthr/thread/thr_sig.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c
index 7bff32b..a9b8d1c 100644
--- a/lib/libthr/thread/thr_sig.c
+++ b/lib/libthr/thread/thr_sig.c
@@ -187,7 +187,6 @@ handle_signal(struct sigaction *actp, int sig, siginfo_t *info, ucontext_t *ucp)
struct pthread *curthread = _get_curthread();
ucontext_t uc2;
__siginfohandler_t *sigfunc;
- int cancel_defer;
int cancel_point;
int cancel_async;
int cancel_enable;
@@ -213,12 +212,10 @@ handle_signal(struct sigaction *actp, int sig, siginfo_t *info, ucontext_t *ucp)
* cancellation is pending, to avoid this problem while thread is in
* deferring mode, cancellation is temporarily disabled.
*/
- cancel_defer = curthread->cancel_defer;
cancel_point = curthread->cancel_point;
cancel_async = curthread->cancel_async;
cancel_enable = curthread->cancel_enable;
curthread->cancel_point = 0;
- curthread->cancel_defer = 0;
if (!cancel_async)
curthread->cancel_enable = 0;
@@ -245,7 +242,6 @@ handle_signal(struct sigaction *actp, int sig, siginfo_t *info, ucontext_t *ucp)
err = errno;
curthread->in_sigsuspend = in_sigsuspend;
- curthread->cancel_defer = cancel_defer;
curthread->cancel_point = cancel_point;
curthread->cancel_enable = cancel_enable;
@@ -275,7 +271,7 @@ check_cancel(struct pthread *curthread, ucontext_t *ucp)
{
if (__predict_true(!curthread->cancel_pending || !curthread->cancel_enable ||
- curthread->cancelling))
+ curthread->no_cancel))
return;
if (curthread->cancel_async) {
OpenPOWER on IntegriCloud