Subject: Re: fork(2) vs. pthread_create() (fwd)
To: Giles Lean <>
From: Emmanuel Dreyfus <>
List: tech-userlevel
Date: 06/09/2004 08:34:48
On Wed, Jun 09, 2004 at 06:25:50PM +1000, Giles Lean wrote:
> > I don't find this very satisfaying. Forking from a program that executed
> > threads works on Linux and FreeBSD. It's not an extraordinary scenario.
> Welcome to the not-so-wonderful world of threads programming.  I'm only
> surprised that this appears to work on other platforms, and like Nathan
> I wonder if it really works or if it just happens not to fall over?

The problem can be observed in milter-greylist-1.3.8 (get it from Here is what happens:

1) We spawn a thread
2) We wait for the thread to temrinate
3) We fork
4) We spawn many threads

That works on Linux and FreeBSD, and it fails on NetBSD with native pthreads. 
In fact, it even works on NetBSD with GNU Pth. 

What happened here is that I wrote a program on NetBSD using GNU Pth, it
worked on all the system I tried, and it broke on NetBSD-2.0. Given that
the program violates no standard, I'd just call it a bug in NetBSD native

Emmanuel Dreyfus