Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Mar 2008 11:08:50 -0500 (EST)
From:      Daniel Eischen <deischen@freebsd.org>
To:        "Marko, Shaun" <Shaun.Marko@lodgenet.com>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: libpthread/fork issue
Message-ID:  <Pine.GSO.4.64.0803071104240.1950@sea.ntplx.net>
In-Reply-To: <87D91DEDB1111C44BBFB9E3E90FF1E6E9553E0@host.lodgenet.com>
References:  <87D91DEDB1111C44BBFB9E3E90FF1E6E9553E0@host.lodgenet.com>

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

-- 
DE



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