From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 9 16:36:01 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 C93B71065675 for ; Sun, 9 Mar 2008 16:36:01 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outY.internet-mail-service.net (outY.internet-mail-service.net [216.240.47.248]) by mx1.freebsd.org (Postfix) with ESMTP id 981E78FC1F for ; Sun, 9 Mar 2008 16:36:01 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Sun, 09 Mar 2008 09:36:00 -0700 Received: from julian-mac.elischer.org (localhost [127.0.0.1]) by idiom.com (Postfix) with ESMTP id 1A4ED2D601A; Sun, 9 Mar 2008 09:35:59 -0700 (PDT) Message-ID: <47D411F5.7010905@elischer.org> Date: Sun, 09 Mar 2008 09:36:05 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.12 (Macintosh/20080213) MIME-Version: 1.0 To: ticso@cicely.de References: <87D91DEDB1111C44BBFB9E3E90FF1E6E9553E0@host.lodgenet.com> <20080309140815.GN34311@cicely12.cicely.de> In-Reply-To: <20080309140815.GN34311@cicely12.cicely.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Daniel Eischen , FreeBSD Hackers , "Marko, Shaun" Subject: Re: libpthread/fork issue X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list 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 16:36:01 -0000 Bernd Walter wrote: > 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? > "probably".. the child in popen does an exec.