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


Ulrich,

This patch is almost a month old.

1. If th->p_terminated is 1, th->p_specific is already deleted. If
you delete them again, you may corrupt the memory.
2. __libc_internal_tsd_get and __libc_internal_tsd_set are referenced
in malloc/malloc.c and defined in linuxthreads/no-tsd.c. We want to
override them with -lpthread. To do that, we have to make them global
in libc.so.

Thanks.

-- 
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: specific.c
===================================================================
RCS file: /local/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/26 01:08:41
@@ -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: Versions
===================================================================
RCS file: /local/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/26 01:08:41
@@ -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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]