diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-01-12 07:29:55 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-01-12 07:29:55 +0000 |
commit | 5ef50d00ded8bb0934c2aef6c9f06acf23f66cb7 (patch) | |
tree | 20f76d7169cf0550d4224e7a2b62aba4943bc4c1 /linuxthreads/pthread.c | |
parent | 7e36861e77d7edde557ebf1172271e922c9a51ff (diff) | |
download | glibc-5ef50d00ded8bb0934c2aef6c9f06acf23f66cb7.tar glibc-5ef50d00ded8bb0934c2aef6c9f06acf23f66cb7.tar.gz glibc-5ef50d00ded8bb0934c2aef6c9f06acf23f66cb7.tar.bz2 glibc-5ef50d00ded8bb0934c2aef6c9f06acf23f66cb7.zip |
Update.
2001-01-11 Jakub Jelinek <jakub@redhat.com>
* stdlib/cxa_atexit.c (__cxa_atexit): Cast to (void *, int) func.
* stdlib/cxa_finalize.c (__cxa_finalize): Add hidden second argument.
* stdlib/cxa_on_exit.c: Remove.
* stdlib/Makefile: Revert last patch.
* stdlib/Versions: Likewise.
* include/stdlib.h: Likewise.
* stdlib/exit.h: Revert last patch.
(struct exit_function): Add second argument to cxa fn.
* stdlib/exit.c: Revert last patch.
(exit): Add hidden second argument.
Diffstat (limited to 'linuxthreads/pthread.c')
-rw-r--r-- | linuxthreads/pthread.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c index 8221787a30..df1d00b05a 100644 --- a/linuxthreads/pthread.c +++ b/linuxthreads/pthread.c @@ -216,7 +216,11 @@ const int __linuxthread_pthread_sizeof_descr /* Forward declarations */ -static void pthread_exit_process(int retcode, void *arg); +static void pthread_onexit_process(int retcode, void *arg); +#ifndef HAVE_Z_NODELETE +static void pthread_atexit_process(void *arg, int retcode); +static void pthread_atexit_retcode(void *arg, int retcode); +#endif static void pthread_handle_sigcancel(int sig); static void pthread_handle_sigrestart(int sig); static void pthread_handle_sigdebug(int sig); @@ -433,12 +437,14 @@ static void pthread_initialize(void) sigprocmask(SIG_BLOCK, &mask, NULL); /* Register an exit function to kill all other threads. */ /* Do it early so that user-registered atexit functions are called - before pthread_exit_process. */ + before pthread_*exit_process. */ +#ifndef HAVE_Z_NODELETE if (__builtin_expect (&__dso_handle != NULL, 1)) - __cxa_on_exit((void (*) (void *)) pthread_exit_process, NULL, + __cxa_atexit ((void (*) (void *)) pthread_atexit_process, NULL, __dso_handle); else - __on_exit (pthread_exit_process, NULL); +#endif + __on_exit (pthread_onexit_process, NULL); /* How many processors. */ __pthread_smp_kernel = is_smp_system (); } @@ -456,6 +462,12 @@ int __pthread_initialize_manager(void) struct rlimit limit; int max_stack; +#ifndef HAVE_Z_NODELETE + if (__builtin_expect (&__dso_handle != NULL, 1)) + __cxa_atexit ((void (*) (void *)) pthread_atexit_retcode, NULL, + __dso_handle); +#endif + getrlimit(RLIMIT_STACK, &limit); #ifdef FLOATING_STACKS if (limit.rlim_cur == RLIM_INFINITY) @@ -723,7 +735,7 @@ weak_alias (__pthread_yield, pthread_yield) /* Process-wide exit() request */ -static void pthread_exit_process(int retcode, void *arg) +static void pthread_onexit_process(int retcode, void *arg) { if (__builtin_expect (__pthread_manager_request, 0) >= 0) { struct pthread_request request; @@ -745,6 +757,20 @@ static void pthread_exit_process(int retcode, void *arg) } } +#ifndef HAVE_Z_NODELETE +static int __pthread_atexit_retcode; + +static void pthread_atexit_process(void *arg, int retcode) +{ + pthread_onexit_process (retcode ?: __pthread_atexit_retcode, arg); +} + +static void pthread_atexit_retcode(void *arg, int retcode) +{ + __pthread_atexit_retcode = retcode; +} +#endif + /* The handler for the RESTART signal just records the signal received in the thread descriptor, and optionally performs a siglongjmp (for pthread_cond_timedwait). */ @@ -851,7 +877,7 @@ void __pthread_kill_other_threads_np(void) { struct sigaction sa; /* Terminate all other threads and thread manager */ - pthread_exit_process(0, NULL); + pthread_onexit_process(0, NULL); /* Make current thread the main thread in case the calling thread changes its mind, does not exec(), and creates new threads instead. */ __pthread_reset_main_thread(); |