1
0
mirror of https://sourceware.org/git/glibc.git synced 2026-01-06 11:51:29 +03:00
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.
This commit is contained in:
Ulrich Drepper
2001-01-12 07:29:55 +00:00
parent 7e36861e77
commit 5ef50d00de
14 changed files with 76 additions and 79 deletions

View File

@@ -1,3 +1,15 @@
2001-01-11 Jakub Jelinek <jakub@redhat.com>
* Makefile (CFLAGS-pthread.c): Pass -DHAVE_Z_NODELETE if ld supports
-z nodelete.
* pthread.c (pthread_exit_process): Rename to...
(pthread_onexit_process): ...this.
(pthread_atexit_process, pthread_atexit_retcode): New.
(pthread_initialize): Call __cxa_atexit instead of __cxa_on_exit
and only if HAVE_Z_NODELETE is not defined.
(__pthread_initialize_manager): Register pthread_atexit_retcode
with __cxa_atexit.
2001-01-11 Ulrich Drepper <drepper@redhat.com>
* pthread.c (pthread_initialize): Use __cxs_on_exit not __cxa_atexit.

View File

@@ -54,9 +54,10 @@ endif
include ../Rules
znodelete-yes = -DHAVE_Z_NODELETE
CFLAGS-mutex.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-specific.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-pthread.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-pthread.c += -D__NO_WEAK_PTHREAD_ALIASES $(znodelete-$(have-z-nodelete))
CFLAGS-ptfork.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-cancel.c += -D__NO_WEAK_PTHREAD_ALIASES
CFLAGS-unload.c += -DPREFIX=\"$(objpfx)\"

View File

@@ -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();