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) {
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to