6.1 libpthread: pthread_create and _pq_insert_tail: Already in priority queue

Daniel Eischen deischen at freebsd.org
Wed Mar 22 14:23:04 UTC 2006


On Wed, 22 Mar 2006, Divacky Roman wrote:

> On Wed, Mar 22, 2006 at 11:24:36AM +0100, Volker Stolz wrote:
> > A rather largish application (the most recent version of GHC, see lang/ghc)
> > fails in its runtime system with:
> >
> > _pq_insert_tail: Already in priority queue
>
> two pointers:
>
> 1) I use ghc daily without this problem
> 2) I got this error when I was playing with threads/mutexes and my code was
> wrong

And what Julian said in a previous email was correct.  POSIX
only guarantees that async-signal-safe functions may be safely
used in a child after a fork() from a multi-threaded process.

Think about it.  A fork() from a multi-threaded process is just
as asynchronous with respect to the other threads as an asyncronous
signal in a single-threaded process.  Internal libc, libpthread,
and process state, as well as state from any other libraries that
are used, is left in an inconsistent state.  An application can
use pthread_atfork(), but POSIX does not require the implementation
to do the equivalent (in libc, libpthread, ...)

-- 
DE



More information about the freebsd-hackers mailing list