From owner-svn-src-all@FreeBSD.ORG Thu Mar 19 10:32:25 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3A781065670; Thu, 19 Mar 2009 10:32:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B21A78FC13; Thu, 19 Mar 2009 10:32:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2JAWPjx058338; Thu, 19 Mar 2009 10:32:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2JAWP1d058337; Thu, 19 Mar 2009 10:32:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903191032.n2JAWP1d058337@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 19 Mar 2009 10:32:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190025 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 10:32:26 -0000 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) {