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-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
}
-/* 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 */