[271] in Pthreads mailing list archive

home help back first fref pref prev next nref lref last post

Re: pthreads and fork()

daemon@ATHENA.MIT.EDU (Samuel Tardieu)
Tue Feb 20 13:16:01 1996

To: pthreads@MIT.EDU
Cc: LE GUENNEC Alain <Alain.LEGUENNEC@enst-bretagne.fr>
Date: 20 Feb 1996 18:34:36 +0100
In-Reply-To: Samuel Tardieu's message of 20 Feb 1996 17:19:17 +0100
Reply-To: Samuel Tardieu <sam@inf.enst.fr>
From: Samuel Tardieu <sam@inf.enst.fr>

>>>>> "Sam" == Samuel Tardieu <sam@inf.enst.fr> writes:

Sam> How is fork() supposed to work with pthreads on Linux ? Is it
Sam> supposed to work or is there anything else which should prevent
Sam> it to do the right job ?

I'll explain my question : a colleague of mine told me that the
following program:

=======
main()
{
        if (fork()==0) {
                printf("Child\n");
                sleep(5); 
                printf("End of child\n");
        } else {
                printf("Father\n");
                sleep(5);
                printf("End of father\n");
        }
}
=======

was never returning from the child process on Linux using a dynamic
version of the pthreads library as bundled with the Linux GNAT
distribution.

Could people with Linux boxes test this simple program for me and send
me a *private* mail (I'll summarize later, don't fill up the mailing
list) with what it did and what pthreads release you used (and
possibly what version of the Linux libc) ?

Thanks in advance for your cooperation.

  Sam

PS/  I'm interested even if you use a static version of the pthreads
     library.
PPS/ The bug seems to occur only with the Linux version, I just tried
     with SunOS and 1.60b4_1 and it works fine.
--
"La cervelle des petits enfants, ca doit avoir comme un petit gout de noisette"
                                                       Charles Baudelaire


home help back first fref pref prev next nref lref last post