about summary refs log tree commit diff
path: root/nptl/sysdeps/pthread
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-01-29 20:38:04 +0000
committerUlrich Drepper <drepper@redhat.com>2009-01-29 20:38:04 +0000
commitcca50323b6a80283886c5fb6e2cff25f6c2d006b (patch)
tree3787ee6c3122d8692610861baba3db91b997e8d8 /nptl/sysdeps/pthread
parentcdf77dd87b27260d1aefbad18aaa169d4a3a6121 (diff)
downloadglibc-cca50323b6a80283886c5fb6e2cff25f6c2d006b.tar.gz
glibc-cca50323b6a80283886c5fb6e2cff25f6c2d006b.tar.xz
glibc-cca50323b6a80283886c5fb6e2cff25f6c2d006b.zip
* allocatestack.c (__free_stacks): Renamed from free_stacks.
	(__free_stack_cache): Removed.  Change callers to call __free_stacks.
	* init.c (nptl_freeres): New function.
	(pthread_functions): Initialize ptr_freeres to nptl_freeres.
	* pthreadP.h: Don't declare __free_stack_cache.  Declare __free_stacks.
	* sysdeps/pthread/unwind-forcedunwind.c (libgcc_s_handle): New
	variable.
	(pthread_cancel_init): Depend in libgcc_s_handle for decision to
	load DSO.  Assign last.
	(__unwind_freeres): New function.

	* allocatestack.c (__reclaim_stacks): Reset in_flight_stack later
	for better debugging.  No need to use stack_list_add here.
Diffstat (limited to 'nptl/sysdeps/pthread')
-rw-r--r--nptl/sysdeps/pthread/unwind-forcedunwind.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/nptl/sysdeps/pthread/unwind-forcedunwind.c b/nptl/sysdeps/pthread/unwind-forcedunwind.c
index 6792d719d3..63f359bd9d 100644
--- a/nptl/sysdeps/pthread/unwind-forcedunwind.c
+++ b/nptl/sysdeps/pthread/unwind-forcedunwind.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2005, 2006, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>.
 
@@ -22,6 +22,7 @@
 #include <unwind.h>
 #include <pthreadP.h>
 
+static void *libgcc_s_handle;
 static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
 static _Unwind_Reason_Code (*libgcc_s_personality)
   (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
@@ -37,7 +38,7 @@ pthread_cancel_init (void)
   void *resume, *personality, *forcedunwind, *getcfa;
   void *handle;
 
-  if (__builtin_expect (libgcc_s_getcfa != NULL, 1))
+  if (__builtin_expect (libgcc_s_handle != NULL, 1))
     {
       /* Force gcc to reload all values.  */
       asm volatile ("" ::: "memory");
@@ -61,11 +62,24 @@ pthread_cancel_init (void)
   libgcc_s_resume = resume;
   libgcc_s_personality = personality;
   libgcc_s_forcedunwind = forcedunwind;
-  /* Make sure libgcc_s_getcfa is written last.  Otherwise,
+  libgcc_s_getcfa = getcfa;
+  /* Make sure libgcc_s_handle is written last.  Otherwise,
      pthread_cancel_init might return early even when the pointer the
      caller is interested in is not initialized yet.  */
   atomic_write_barrier ();
-  libgcc_s_getcfa = getcfa;
+  libgcc_s_handle = handle;
+}
+
+void
+__libc_freeres_fn_section
+__unwind_freeres (void)
+{
+  void *handle = libgcc_s_handle;
+  if (handle != NULL)
+    {
+      libgcc_s_handle = NULL;
+      __libc_dlclose (handle);
+    }
 }
 
 void