svn commit: r190025 - head/lib/libthr/thread

Konstantin Belousov kib at FreeBSD.org
Thu Mar 19 03:32:26 PDT 2009


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) {


More information about the svn-src-all mailing list