From owner-freebsd-threads@FreeBSD.ORG Tue Oct 25 12:52:18 2005 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2F89D16A437; Tue, 25 Oct 2005 12:52:18 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id C0E2C43D48; Tue, 25 Oct 2005 12:52:17 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.ntplx.net (8.13.5/8.13.5/NETPLEX) with ESMTP id j9PCqGYL013213; Tue, 25 Oct 2005 08:52:16 -0400 (EDT) Date: Tue, 25 Oct 2005 08:52:16 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Sven Berkvens-Matthijsse In-Reply-To: <20051025071619.GS22568@ilse.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) Cc: Marc Olzheim , Marc Olzheim , David Xu , freebsd-threads@freebsd.org Subject: Re: threads/76690: fork hang in child for (-lc_r & -lthr) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2005 12:52:18 -0000 On Tue, 25 Oct 2005, Sven Berkvens-Matthijsse wrote: > > > But then the free() in the child process may be using an unstable > > > state of the malloc system (because if you don't acquire the lock > > > before the fork(), malloc() may be busy in the middle of the > > > fork()). > > > > I don't think that can happen because libc_r will not switch out a > > thread that is in a critical region (and libc locks are critical > > regions) until it leaves the region. > > What code leads you to that conclusion? All the malloc functions I had thought that spinlocks and internal mutexes (_pthread_mutex_lock() called from libc) would mark critical regions. That was the intent, but it doesn't seem to be implemented that way in libc_r. It _is_ implemented that way in libpthread. -- DE