diff options
Diffstat (limited to 'linuxthreads')
-rw-r--r-- | linuxthreads/ChangeLog | 6 | ||||
-rw-r--r-- | linuxthreads/pthread.c | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index bb31553..ce335a7 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 5884b9b..57bc15e 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) |