This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: pthread detach problem with glibc 2.2 on SMP


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]