pthread gotchas

Robert Collins
Fri May 18 19:53:00 GMT 2001

----- Original Message -----
From: "Christopher Faylor" <>
To: <>
Sent: Saturday, May 19, 2001 12:45 PM
Subject: Re: pthread gotchas

> On Sat, May 19, 2001 at 12:32:10PM +1000, Robert Collins wrote:
> >>work with pthreads.  I ran the program on linux.
>                        ^^^^^^^^^^^^^^^^^^^^^^^^^^

I'm just guessing here, but you would like me to actually read what you
write? I guess that mental telepathy isn't as good as we thought :]

> This email was talking about linux.  I ran the program on linux first
> that I could get a feel for how it was supposed to work and was
> surprised to find that linux broke my perceptions.

openBSD  test results:

in subproc, sleeping
in parent, starting thread, pid 12819in tf, waiting for 12819
0 = pthread_create
in subproc, exiting
12819 = waitpid
waitpid: Undefined error: 0
0 = pthread_join

> I have included my test program below.  The waitpid, which is invoked
> the secondary thread fails unless I move the fork into the same

I haven't looked into why yet.

> #include <stdio.h>
> #include <pthread.h>
> #include <wait.h>

btw: wait.h should be sys/wait according to the SUS.


More information about the Cygwin-developers mailing list