This is the mail archive of the libc-hacker@cygnus.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]

A patch for linuxthreads


Hi,

This Linuxthreads patch should fix

http://egcs.cygnus.com/ml/egcs-bugs/1999-03/msg00316.html

The problem is we should not access those key data stuctures after
a thread is terminared since they have been freed.

The patch for Versions fixes another bug. 


-- 
H.J. Lu (hjl@gnu.org)
--
Tue Mar 16 19:30:50 1999  H.J. Lu  <hjl@gnu.org>

	* specific.c (pthread_key_delete): Check th->p_terminated to
	if the thread is running.

	* Versions (__libc_internal_tsd_get, __libc_internal_tsd_set):
	Added to GLIBC_2.0 for libc.so.

Index: Versions
===================================================================
RCS file: /work/cvs/gnu/glibc/linuxthreads/Versions,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 Versions
--- Versions	1999/02/16 23:21:28	1.1.1.3
+++ Versions	1999/03/17 04:21:23
@@ -13,6 +13,9 @@ libc {
     pthread_mutexattr_getkind_np; pthread_mutexattr_setkind_np;
     pthread_self; pthread_setcancelstate; pthread_setcanceltype;
     pthread_setschedparam;
+
+    # Internal libc interface to libpthread
+    __libc_internal_tsd_get; __libc_internal_tsd_set;
   }
   GLIBC_2.1 {
     pthread_attr_init;
Index: specific.c
===================================================================
RCS file: /work/cvs/gnu/glibc/linuxthreads/specific.c,v
retrieving revision 1.1.1.5
diff -u -p -r1.1.1.5 specific.c
--- specific.c	1998/12/01 16:22:30	1.1.1.5
+++ specific.c	1999/03/17 03:30:10
@@ -80,7 +80,7 @@ int pthread_key_delete(pthread_key_t key
   idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE;
   th = self;
   do {
-    if (th->p_specific[idx1st] != NULL)
+    if (!th->p_terminated && th->p_specific[idx1st] != NULL)
       th->p_specific[idx1st][idx2nd] = NULL;
     th = th->p_nextlive;
   } while (th != self);


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