This is the mail archive of the
libc-hacker@cygnus.com
mailing list for the glibc project.
Re: Why __libc_internal_tsd_get/__libc_internal_tsd_set
- To: zack@rabi.columbia.edu (Zack Weinberg)
- Subject: Re: Why __libc_internal_tsd_get/__libc_internal_tsd_set
- From: hjl@lucon.org (H.J. Lu)
- Date: Fri, 19 Mar 1999 13:59:12 -0800 (PST)
- Cc: libc-hacker@cygnus.com (GNU C Library)
>
> On Fri, 19 Mar 1999 14:13:19 -0500, Roland McGrath wrote:
> >> It only works with static libraries. It doesn't work with shared
> >> libraries. To work with shared libraries, weak symbols should be used
> >> instead.
> >
> >You have not told us about any specific problem or given us any reason to
> >believe there is in fact a problem. If you want anyone to do anything
> >about the bugs you claim to find, then you have to show us the bugs.
>
> I suspect based on context that this has to do with the appended program,
> which is reported to segfault inside malloc on 2.0. I would test it on 2.1
> but my machine is dead right now.
>
> I have no idea why HJ thinks the fix is to muck around with the symbol
> table. It looks to me like a locking bug.
>
Here is the patch again. Please let me know if you have questions.
H.J.
------
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);