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: aj at suse dot de
- Subject: Re: pthread detach problem with glibc 2.2 on SMP
- From: Wolfram Gloger <Wolfram dot Gloger at dent dot med dot uni-muenchen dot de>
- Date: Wed, 6 Dec 2000 09:45:21 +0100 ("MET)
- CC: libc-alpha at sourceware dot cygnus dot com, ro at suse dot de
- References: <hozoiaq8qi.fsf@gee.suse.de>
> 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
>
> with an exit status of 15. I'm running glibc 2.2 here.
Does the patch below help?
Regards,
Wolfram.
2000-12-06 Wolfram Gloger <wg@malloc.de>
* join.c (pthread_detach): Allow case where the thread has already
terminated.
--- join.c 2000/12/06 08:37:38 1.1
+++ join.c 2000/12/06 08:40:00
@@ -181,11 +181,11 @@
pthread_descr th;
__pthread_lock(&handle->h_lock, NULL);
- if (invalid_handle(handle, thread_id)) {
+ th = handle->h_descr;
+ if (th == NULL || th->p_tid != thread_id) {
__pthread_unlock(&handle->h_lock);
return ESRCH;
}
- th = handle->h_descr;
/* If already detached, error */
if (th->p_detached) {
__pthread_unlock(&handle->h_lock);