]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Wed, 31 Mar 2004 01:47:34 +0000 (01:47 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 31 Mar 2004 01:47:34 +0000 (01:47 +0000)
2004-03-30  Ulrich Drepper  <drepper@redhat.com>

* sysdeps/generic/libc-start.c (LIBC_START_MAIN)
[HAVE_CLEANUP_JMP_BUF]: Call __nptl_deallocate_tsd.

ChangeLog
nptl/ChangeLog
nptl/Makefile
nptl/init.c
nptl/pthreadP.h
nptl/pthread_create.c
nptl/sysdeps/pthread/pthread-functions.h
nptl/tst-tsd5.c [new file with mode: 0644]
sysdeps/generic/libc-start.c

index 9ad8a51cfd2fcc67aec811ec58a2eea0b5e761d4..d2303fb151a8bde2a507755d8ea5e45428a28a41 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-03-30  Ulrich Drepper  <drepper@redhat.com>
+
+       * sysdeps/generic/libc-start.c (LIBC_START_MAIN)
+       [HAVE_CLEANUP_JMP_BUF]: Call __nptl_deallocate_tsd.
+
 2004-03-30  Jakub Jelinek  <jakub@redhat.com>
 
        * nis/nss_nis/nis-service.c (_nss_nis_getservbyname_r): If protocol
index 4e400f67f9f973d511b6e1eb0c8d4ac78ca6d648..ccbaef276dbae51bbde96d27db37f7fb49ff6e4c 100644 (file)
@@ -1,3 +1,14 @@
+2004-03-30  Ulrich Drepper  <drepper@redhat.com>
+
+       * sysdeps/pthread/pthread-functions.h: Add ptr__nptl_deallocate_tsd.
+       * init.c (pthread_functions): Add ptr__nptl_deallocate_tsd.
+       * pthreadP.h: Declare __nptl_deallocate_tsd.
+       * pthread_create.c (deallocate_tsd): Remove to __nptl_deallocate_tsd.
+       Adjust caller.
+
+       * Makefile (tests): Add tst-tsd5.
+       * tst-tsd5.c: New file.
+
 2004-03-29  Ulrich Drepper  <drepper@redhat.com>
 
        * sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c
index c3bc89cb4375b97205ca53135586653974d4fe78..484824fea6b879f3995b5d44185009f2054291f4 100644 (file)
@@ -210,7 +210,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
        tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 \
        tst-detach1 \
        tst-eintr1 tst-eintr2 tst-eintr3 tst-eintr4 tst-eintr5 \
-       tst-tsd1 tst-tsd2 tst-tsd3 tst-tsd4 \
+       tst-tsd1 tst-tsd2 tst-tsd3 tst-tsd4 tst-tsd5 \
        tst-tls1 tst-tls2 \
        tst-fork1 tst-fork2 tst-fork3 tst-fork4 \
        tst-atfork1 \
index 47bb0a6f72d8ff138eb8a8a278e12cecb71490c9..e58dae0ba6d0320f9f3b7e185d7d7f788d953d92 100644 (file)
@@ -130,7 +130,8 @@ static const struct pthread_functions pthread_functions =
     .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer,
     .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore,
     .ptr_nthreads = &__nptl_nthreads,
-    .ptr___pthread_unwind = &__pthread_unwind
+    .ptr___pthread_unwind = &__pthread_unwind,
+    .ptr__nptl_deallocate_tsd = __nptl_deallocate_tsd
   };
 # define ptr_pthread_functions &pthread_functions
 #else
index ba9529f01b1f9e08f6074093c600c7fa52fd3e63..c0941f0cf5c78fd1447c4107bd1f40b1d4546f97 100644 (file)
@@ -439,4 +439,6 @@ extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
 extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
                                           int execute);
 
+extern void __nptl_deallocate_tsd (void) attribute_hidden;
+
 #endif /* pthreadP.h */
index 014c41b7a4b3fd8c141eb3d30116ab057c33d71b..34edee498fa45d8051bc563f58b3a87c3cb04910 100644 (file)
@@ -102,9 +102,9 @@ __find_in_stack_list (pd)
 
 
 /* Deallocate POSIX thread-local-storage.  */
-static void
-internal_function
-deallocate_tsd (void)
+void
+attribute_hidden
+__nptl_deallocate_tsd (void)
 {
   struct pthread *self = THREAD_SELF;
 
@@ -268,7 +268,7 @@ start_thread (void *arg)
     }
 
   /* Run the destructor for the thread-local data.  */
-  deallocate_tsd ();
+  __nptl_deallocate_tsd ();
 
   /* Clean up any state libc stored in thread-local variables.  */
   __libc_thread_freeres ();
index 38155e240ff6e1d2745effab033d449b1adbc478..23af21451893c22bb593d8c8d18f18d1d8f0bd28 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -92,6 +92,7 @@ struct pthread_functions
   int *ptr_nthreads;
   void (*ptr___pthread_unwind) (__pthread_unwind_buf_t *)
        __attribute ((noreturn)) __cleanup_fct_attribute;
+  void (*ptr__nptl_deallocate_tsd) (void);
 };
 
 /* Variable in libc.so.  */
diff --git a/nptl/tst-tsd5.c b/nptl/tst-tsd5.c
new file mode 100644 (file)
index 0000000..8793e33
--- /dev/null
@@ -0,0 +1,81 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
+
+
+static void
+cl (void *p)
+{
+  pthread_mutex_unlock (&m);
+}
+
+
+static void *
+tf (void *arg)
+{
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("2nd mutex_lock failed");
+      exit (1);
+    }
+
+  exit (0);
+}
+
+
+static int
+do_test (void)
+{
+  pthread_key_t k;
+  if (pthread_key_create (&k, cl) != 0)
+    {
+      puts ("key_create failed");
+      return 1;
+    }
+  if (pthread_setspecific (k, (void *) 1) != 0)
+    {
+      puts ("setspecific failed");
+      return 1;
+    }
+
+  if (pthread_mutex_lock (&m) != 0)
+    {
+      puts ("1st mutex_lock failed");
+      return 1;
+    }
+
+  pthread_t th;
+  if (pthread_create (&th, NULL, tf, NULL) != 0)
+    {
+      puts ("create failed");
+      return 1;
+    }
+
+  pthread_exit (NULL);
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
index b92ab04fdb48d758feecd6083e909194ab6e5731..fc9df40996e334c11c5e05cfc370b29b136f2461 100644 (file)
@@ -210,6 +210,14 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
     }
   else
     {
+      /* Remove the thread-local data.  */
+# ifdef SHARED
+      __libc_pthread_functions.ptr__nptl_deallocate_tsd ();
+# else
+      extern void __nptl_deallocate_tsd (void) __attribute ((weak));
+      __nptl_deallocate_tsd ();
+# endif
+
       /* One less thread.  Decrement the counter.  If it is zero we
         terminate the entire process.  */
       result = 0;