about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-03-20 07:07:18 +0000
committerUlrich Drepper <drepper@redhat.com>2000-03-20 07:07:18 +0000
commita6a478e9f927835469cd1b770f395df640966c49 (patch)
tree1d5c8a1733a4709eccfa952e0785691a6f59c433
parent41a173e1e3a19957dfbed6375e84b8a3363035a7 (diff)
downloadglibc-a6a478e9f927835469cd1b770f395df640966c49.tar.gz
glibc-a6a478e9f927835469cd1b770f395df640966c49.tar.xz
glibc-a6a478e9f927835469cd1b770f395df640966c49.zip
Update.
	* include/stdlib.h: Add prototype for __cxa_atexit.
-rw-r--r--ChangeLog2
-rw-r--r--include/stdlib.h2
-rw-r--r--linuxthreads/ChangeLog6
-rw-r--r--linuxthreads/pthread.c10
4 files changed, 19 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 22e440a451..10fe7e4068 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2000-03-19  Ulrich Drepper  <drepper@redhat.com>
 
+	* include/stdlib.h: Add prototype for __cxa_atexit.
+
 	* sysdeps/unix/sysv/linux/i386/sys/debugreg.h: Update comment about
 	_SLOWDOWN flags.  Patch by Jim Blandy <jimb@cygnus.com>.
 
diff --git a/include/stdlib.h b/include/stdlib.h
index 38fd33d7b3..edca2009e0 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -53,6 +53,8 @@ extern int __add_to_environ (const char *name, const char *value,
 extern void _quicksort (void *const pbase, size_t total_elems,
 			size_t size, __compar_fn_t cmp);
 
+extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
+
 #endif
 #undef __Need_M_And_C
 
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index bb3155347a..ce335a70fe 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,9 @@
+2000-03-19  Ulrich Drepper  <drepper@redhat.com>
+
+	* pthread.c (pthread_initialize): Instead of on_exit use
+	__cxa_atexit if __dso_label is available to allow unloading the
+	libpthread shared library.
+
 2000-03-16  Ulrich Drepper  <drepper@redhat.com>
 
 	* condvar.c: Make tests for ownership of mutex less strict.
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 5884b9b460..57bc15e512 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -308,6 +308,8 @@ __libc_allocate_rtsig (int high)
 
 static void pthread_initialize(void) __attribute__((constructor));
 
+extern void *__dso_handle __attribute__ ((weak));
+
 static void pthread_initialize(void)
 {
   struct sigaction sa;
@@ -387,7 +389,13 @@ static void pthread_initialize(void)
   /* Register an exit function to kill all other threads. */
   /* Do it early so that user-registered atexit functions are called
      before pthread_exit_process. */
-  __on_exit(pthread_exit_process, NULL);
+  if (__dso_handle)
+    /* The cast is a bit unclean.  The function expects two arguments but
+       we can only pass one.  Fortunately this is not a problem since the
+       second argument of `pthread_exit_process' is simply ignored.  */
+    __cxa_atexit((void (*) (void *)) pthread_exit_process, NULL, __dso_handle);
+  else
+    on_exit (pthread_exit_process, NULL);
 }
 
 void __pthread_initialize(void)