This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Bug with popen/pthread_create
Jakub Jelinek <jakub@redhat.com> writes:
> On Thu, Feb 06, 2003 at 01:58:22PM -0500, Neal H. Walfield wrote:
> > > This does not matter. This is no real world program, this is a short
> > > example which triggers the bug. That's everything.
> >
> > No, fix your buggy program: pthread_wait for threads who have not
> > finished before returning from main or calling exit. That's
> > everything.
>
> You're wrong.
Often, but not here. Here is an excerpt from the latest issue of the
Single Unix Specification on the semantics of pthread_create:
The thread is created executing start_routine with arg as its
sole argument. If the start_routine returns, the effect shall
be as if there was an implicit call to pthread_exit() using
the return value of start_routine as the exit status. Note
that the thread in which main() was originally invoked differs
from this. When it returns from main(), the effect shall be as
if there was an implicit call to exit() using the return value
of main() as the exit status.
> There is a bug in linuxthreads in the
This is perhaps true, his program is still buggy as it does not wait
for the thread.