This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: pthread detach problem with glibc 2.2 on SMP
- To: Ulrich Drepper <drepper at cygnus dot com>
- Subject: Re: pthread detach problem with glibc 2.2 on SMP
- From: Momchil Velikov <velco at fadata dot bg>
- Date: Wed, 06 Dec 2000 10:49:47 +0100
- CC: Andreas Jaeger <aj at suse dot de>, libc-alpha Mailinglist <libc-alpha at sourceware dot cygnus dot com>, Ruediger Oertel <ro at suse dot de>
- References: <hozoiaq8qi.fsf@gee.suse.de> <m366ky7y97.fsf@otr.mynet.cygnus.com>
Ulrich Drepper wrote:
>
> Andreas Jaeger <aj@suse.de> writes:
>
> > The following program compiled with:
> > gcc -o pthread-test -g -O2 pthread-test.c -lpthread -Wall
> >
> > gives sometimes (try it at least 20 times) on an SMP system as result:
> > abc: Interrupted system call
> > def: Invalid argument
>
> The behavior is correct. pthread_detach() returns ESRCH if the thread
> ID is not valid. This can happen if the newly created thread gets
> scheduled before the creating thread. It's a simple race condition.
No. Provided that the call to `pthread_create()' was successful,
and the thread is not created detached, the call to `pthread_detach()'
should succeed no matter if the thread has already been scheduled,
terminated, etc., or not.
Regards,
-velco