libpthread/fork issue
Daniel Eischen
deischen at freebsd.org
Fri Mar 7 16:32:36 UTC 2008
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
More information about the freebsd-hackers
mailing list