From 2ca0e1eded054dced59e390aebf48519d0a9456e Mon Sep 17 00:00:00 2001 From: kib Date: Thu, 19 Mar 2009 10:32:25 +0000 Subject: 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 --- lib/libthr/thread/thr_fork.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/libthr/thread/thr_fork.c') 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) { -- cgit v1.1