Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Mar 2008 15:08:16 +0100
From:      Bernd Walter <ticso@cicely12.cicely.de>
To:        Daniel Eischen <deischen@freebsd.org>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>, "Marko, Shaun" <Shaun.Marko@lodgenet.com>
Subject:   Re: libpthread/fork issue
Message-ID:  <20080309140815.GN34311@cicely12.cicely.de>
In-Reply-To: <Pine.GSO.4.64.0803071104240.1950@sea.ntplx.net>
References:  <87D91DEDB1111C44BBFB9E3E90FF1E6E9553E0@host.lodgenet.com> <Pine.GSO.4.64.0803071104240.1950@sea.ntplx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080309140815.GN34311>