Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Mar 2009 10:32:25 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r190025 - head/lib/libthr/thread
Message-ID:  <200903191032.n2JAWP1d058337@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Mar 19 10:32:25 2009
New Revision: 190025
URL: http://svn.freebsd.org/changeset/base/190025

Log:
  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

Modified:
  head/lib/libthr/thread/thr_fork.c

Modified: head/lib/libthr/thread/thr_fork.c
==============================================================================
--- head/lib/libthr/thread/thr_fork.c	Thu Mar 19 10:23:26 2009	(r190024)
+++ head/lib/libthr/thread/thr_fork.c	Thu Mar 19 10:32:25 2009	(r190025)
@@ -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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903191032.n2JAWP1d058337>