aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-30 10:14:00 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-30 10:14:00 +0000
commit3dd2c3e24702b91473b30d5a0baf9954c37fd35b (patch)
treec1b05424b4c65780fba6165603458d988441633f
parent02c66840524d73f1fac9efe152ed046418263a8f (diff)
downloadglibc-3dd2c3e24702b91473b30d5a0baf9954c37fd35b.zip
glibc-3dd2c3e24702b91473b30d5a0baf9954c37fd35b.tar.gz
glibc-3dd2c3e24702b91473b30d5a0baf9954c37fd35b.tar.bz2
Update.
1998-04-30 Ulrich Drepper <drepper@cygnus.com> * manager.c (pthread_free): Detect already free child. Patch by Xavier Leroy, reported by Matthias Urlichs.
-rw-r--r--linuxthreads/ChangeLog5
-rw-r--r--linuxthreads/manager.c14
2 files changed, 18 insertions, 1 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index e875474..4f0c67e 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,8 @@
+1998-04-30 Ulrich Drepper <drepper@cygnus.com>
+
+ * manager.c (pthread_free): Detect already free child.
+ Patch by Xavier Leroy, reported by Matthias Urlichs.
+
1998-04-23 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile (linuxthreads-version): Renamed back from
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index 8844dec..993df00 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -308,10 +308,22 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
}
-/* Free the resources of a thread. */
+/* Try to free the resources of a thread when requested by pthread_join
+ or pthread_detach on a terminated thread. */
static void pthread_free(pthread_descr th)
{
+ pthread_descr t;
+
+ /* Check that the thread th is still there -- pthread_reap_children
+ might have deallocated it already */
+ t = __pthread_main_thread;
+ do {
+ if (t == th) break;
+ t = t->p_nextlive;
+ } while (t != __pthread_main_thread);
+ if (t != th) return;
+
pthread_handle handle;
ASSERT(th->p_exited);
/* Make the handle invalid */