summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-03-19 10:32:25 +0000
committerkib <kib@FreeBSD.org>2009-03-19 10:32:25 +0000
commit2ca0e1eded054dced59e390aebf48519d0a9456e (patch)
treea0450674c2c0d99069b790fb48baa2337ceb6d84 /lib/libthr
parent363d0f86330f4538f3809062e530487a08812859 (diff)
downloadFreeBSD-src-2ca0e1eded054dced59e390aebf48519d0a9456e.zip
FreeBSD-src-2ca0e1eded054dced59e390aebf48519d0a9456e.tar.gz
Forcibly unlock the malloc() locks in the child process after fork(),
by temporary pretending that the process is still multithreaded. Current malloc lock primitives do nothing for singlethreaded process. Reviewed by: davidxu, deischen
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_fork.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_fork.c b/lib/libthr/thread/thr_fork.c
index bc410d1..afb5a1d 100644
--- a/lib/libthr/thread/thr_fork.c
+++ b/lib/libthr/thread/thr_fork.c
@@ -173,8 +173,11 @@ _fork(void)
/* Ready to continue, unblock signals. */
_thr_signal_unblock(curthread);
- if (unlock_malloc)
+ if (unlock_malloc) {
+ __isthreaded = 1;
_malloc_postfork();
+ __isthreaded = 0;
+ }
/* Run down atfork child handlers. */
TAILQ_FOREACH(af, &_thr_atfork_list, qe) {
OpenPOWER on IntegriCloud