From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 9 14:08:29 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC681106566B for ; Sun, 9 Mar 2008 14:08:29 +0000 (UTC) (envelope-from ticso@cicely12.cicely.de) Received: from raven.bwct.de (raven.bwct.de [85.159.14.73]) by mx1.freebsd.org (Postfix) with ESMTP id 3957B8FC1E for ; Sun, 9 Mar 2008 14:08:28 +0000 (UTC) (envelope-from ticso@cicely12.cicely.de) Received: from cicely5.cicely.de ([10.1.1.7]) by raven.bwct.de (8.13.4/8.13.4) with ESMTP id m29E8Qs2089813; Sun, 9 Mar 2008 15:08:26 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (cicely12.cicely.de [10.1.1.14]) by cicely5.cicely.de (8.13.4/8.13.4) with ESMTP id m29E8Hxw072664 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 9 Mar 2008 15:08:17 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (localhost [127.0.0.1]) by cicely12.cicely.de (8.13.4/8.13.3) with ESMTP id m29E8H6D044844; Sun, 9 Mar 2008 15:08:17 +0100 (CET) (envelope-from ticso@cicely12.cicely.de) Received: (from ticso@localhost) by cicely12.cicely.de (8.13.4/8.13.3/Submit) id m29E8Gxi044843; Sun, 9 Mar 2008 15:08:16 +0100 (CET) (envelope-from ticso) Date: Sun, 9 Mar 2008 15:08:16 +0100 From: Bernd Walter To: Daniel Eischen Message-ID: <20080309140815.GN34311@cicely12.cicely.de> References: <87D91DEDB1111C44BBFB9E3E90FF1E6E9553E0@host.lodgenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD cicely12.cicely.de 5.4-STABLE alpha User-Agent: Mutt/1.5.9i X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED=-1.8, BAYES_00=-2.599 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on cicely12.cicely.de Cc: FreeBSD Hackers , "Marko, Shaun" Subject: Re: libpthread/fork issue X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ticso@cicely.de List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Mar 2008 14:08:29 -0000 On Fri, Mar 07, 2008 at 11:08:50AM -0500, Daniel Eischen wrote: > On Thu, 6 Mar 2008, Marko, Shaun wrote: > > >I'm working on FreeBSD 6.2 and I'm wondering if anybody can help with an > >issue I've found using fork and threads. The attached program > >demonstrates the problem. In short, if a process creates a thread, joins > >the thread, then forks a child process which creates a thread, the > >child's attempt to create a thread will cause the program to dump core > >with the following error message: > >Fatal error 'mutex is on list' at line 540 in file > >/usr/src/lib/libpthread/thread/thr_mutex.c (errno = 0). > > You are not allowed by POSIX to call any non-async-signal-safe > function from a child of a threaded program. There's words > or rationale to the effect that the only purpose for forking > from a threaded program should be to call one of the exec* > functions. Trying to create a thread from a child (like > you are trying to do) is definitely not supported. I've often done it, but since this is subject right now it is a good point to ask if I just had luck so far. Is it allowed to use popen(3) from a threaded programm? -- B.Walter http://www.bwct.de http://www.fizon.de bernd@bwct.de info@bwct.de support@fizon.de