pthread detach problem with glibc 2.2 on SMP
Momchil Velikov
velco@fadata.bg
Wed Dec 6 00:41:00 GMT 2000
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
More information about the Libc-alpha
mailing list