summaryrefslogtreecommitdiffstats
path: root/lib/libkse
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2004-04-08 23:16:21 +0000
committerdeischen <deischen@FreeBSD.org>2004-04-08 23:16:21 +0000
commit6920f21350843fac10f5249f2128ee961be66735 (patch)
tree5c4ce9482f48498a0c6de00a8396afa0e05eb845 /lib/libkse
parent9d70c1606dc67c40c623ffc82bbffbf77842f4a1 (diff)
downloadFreeBSD-src-6920f21350843fac10f5249f2128ee961be66735.zip
FreeBSD-src-6920f21350843fac10f5249f2128ee961be66735.tar.gz
After forking and initializing the library to single-threaded
mode (where the forked thread is the one and only thread and is marked as system scope), set the system scope flag before initializing the signal mask. This prevents trying to use internal locks that haven't yet been initialized. Reported by: Dan Nelson <dnelson at allantgroup.com> Reviewed by: davidxu
Diffstat (limited to 'lib/libkse')
-rw-r--r--lib/libkse/thread/thr_kern.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c
index c72e915..d9a5179 100644
--- a/lib/libkse/thread/thr_kern.c
+++ b/lib/libkse/thread/thr_kern.c
@@ -347,13 +347,14 @@ _kse_single_thread(struct pthread *curthread)
_thr_signal_deinit();
}
__isthreaded = 0;
+ curthread->kse->k_kcb->kcb_kmbx.km_curthread = NULL;
+ curthread->attr.flags |= PTHREAD_SCOPE_SYSTEM;
+
/*
* Restore signal mask early, so any memory problems could
* dump core.
*/
sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
- curthread->kse->k_kcb->kcb_kmbx.km_curthread = NULL;
- curthread->attr.flags |= PTHREAD_SCOPE_SYSTEM;
_thr_active_threads = 1;
#endif
}
OpenPOWER on IntegriCloud