diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-04-19 18:26:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-04-19 18:26:10 +0000 |
commit | 4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061 (patch) | |
tree | 5d2a3274fca36375eb460f483d802db22c0fea5e | |
parent | 2c008571c3ad156479307b7e23185ae566b5776a (diff) | |
download | glibc-4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061.tar.gz glibc-4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061.tar.xz glibc-4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061.zip |
Update.
* stdlib/cxa_finalize.c (__cxa_finalize): Don't call UNREGISTER_ATFORK if d == NULL.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | nptl/semaphore.h | 17 | ||||
-rw-r--r-- | nptl/sysdeps/pthread/pthread.h | 28 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/unregister-atfork.c | 20 | ||||
-rw-r--r-- | stdlib/cxa_finalize.c | 9 |
5 files changed, 57 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog index 928e339da8..76c796a40a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2003-04-19 Ulrich Drepper <drepper@redhat.com> + * stdlib/cxa_finalize.c (__cxa_finalize): Don't call + UNREGISTER_ATFORK if d == NULL. + * catgets/nl_types.h: Remove __THROW marker from cancellation points. * dirent/dirent.h: Likewise. * dlfcn/dlfcn.h: Likewise. diff --git a/nptl/semaphore.h b/nptl/semaphore.h index b8861e5da2..b29f8c24c5 100644 --- a/nptl/semaphore.h +++ b/nptl/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -48,14 +48,19 @@ extern int sem_close (sem_t *__sem) __THROW; /* Remove named semaphore NAME. */ extern int sem_unlink (__const char *__name) __THROW; -/* Wait for SEM being posted. */ -extern int sem_wait (sem_t *__sem) __THROW; +/* Wait for SEM being posted. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int sem_wait (sem_t *__sem); #ifdef __USE_XOPEN2K -/* Similar to `sem_wait' but wait only until ABSTIME. */ +/* Similar to `sem_wait' but wait only until ABSTIME. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int sem_timedwait (sem_t *__restrict __sem, - __const struct timespec *__restrict __abstime) - __THROW; + __const struct timespec *__restrict __abstime); #endif /* Test whether SEM is posted. */ diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h index ceb1077617..d06dd8f45a 100644 --- a/nptl/sysdeps/pthread/pthread.h +++ b/nptl/sysdeps/pthread/pthread.h @@ -182,8 +182,11 @@ extern void pthread_exit (void *__retval) /* Make calling thread wait for termination of the thread TH. The exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN - is not NULL. */ -extern int pthread_join (pthread_t __th, void **__thread_return) __THROW; + is not NULL. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int pthread_join (pthread_t __th, void **__thread_return); #ifdef __USE_GNU /* Check whether thread TH has terminated. If yes return the status of @@ -192,9 +195,12 @@ extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; /* Make calling thread wait for termination of the thread TH, but only until TIMEOUT. The exit status of the thread is stored in - *THREAD_RETURN, if THREAD_RETURN is not NULL. */ + *THREAD_RETURN, if THREAD_RETURN is not NULL. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return, - __const struct timespec *__abstime) __THROW; + __const struct timespec *__abstime); #endif /* Indicate that the thread TH is never to be joined with PTHREAD_JOIN. @@ -635,18 +641,24 @@ extern int pthread_cond_signal (pthread_cond_t *__cond) __THROW; extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROW; /* Wait for condition variable COND to be signaled or broadcast. - MUTEX is assumed to be locked before. */ + MUTEX is assumed to be locked before. + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, - pthread_mutex_t *__restrict __mutex) __THROW; + pthread_mutex_t *__restrict __mutex); /* Wait for condition variable COND to be signaled or broadcast until ABSTIME. MUTEX is assumed to be locked before. ABSTIME is an absolute time specification; zero is the beginning of the epoch - (00:00:00 GMT, January 1, 1970). */ + (00:00:00 GMT, January 1, 1970). + + This function is a cancellation point and therefore not marked with + __THROW. */ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, __const struct timespec *__restrict - __abstime) __THROW; + __abstime); /* Functions for handling condition variable attributes. */ diff --git a/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c b/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c index 7b3a785923..e9eb1918f6 100644 --- a/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c +++ b/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c @@ -22,6 +22,14 @@ #include "fork.h" +/* Defined in libc_pthread_init.c. */ +extern struct fork_handler __pthread_child_handler attribute_hidden; +/* Three static memory blocks used when registering malloc. */ +static struct fork_handler malloc_prepare; +static struct fork_handler malloc_parent; +static struct fork_handler malloc_child; + + void __unregister_atfork (dso_handle) void *dso_handle; @@ -37,7 +45,9 @@ __unregister_atfork (dso_handle) { list_del (runp); - free (list_entry (runp, struct fork_handler, list)); + struct fork_handler *p = list_entry (runp, struct fork_handler, list); + if (p != &malloc_prepare) + free (p); } list_for_each_prev_safe (runp, prevp, &__fork_parent_list) @@ -45,7 +55,9 @@ __unregister_atfork (dso_handle) { list_del (runp); - free (list_entry (runp, struct fork_handler, list)); + struct fork_handler *p = list_entry (runp, struct fork_handler, list); + if (p != &malloc_parent) + free (p); } list_for_each_prev_safe (runp, prevp, &__fork_child_list) @@ -53,7 +65,9 @@ __unregister_atfork (dso_handle) { list_del (runp); - free (list_entry (runp, struct fork_handler, list)); + struct fork_handler *p = list_entry (runp, struct fork_handler, list); + if (p != &__pthread_child_handler && p != &malloc_child) + free (p); } /* Release the lock. */ diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c index 792aeeb3b5..2339c7b5bd 100644 --- a/stdlib/cxa_finalize.c +++ b/stdlib/cxa_finalize.c @@ -23,7 +23,8 @@ #include <fork.h> /* If D is non-NULL, call all functions registered with `__cxa_atexit' - with the same dso handle. Otherwise, if D is NULL, do nothing. */ + with the same dso handle. Otherwise, if D is NULL, call all of the + registered handlers. */ void __cxa_finalize (void *d) { @@ -41,8 +42,10 @@ __cxa_finalize (void *d) (*f->func.cxa.fn) (f->func.cxa.arg, 0); } - /* Remove the registered fork handlers. */ + /* Remove the registered fork handlers. We do not have to + unregister anything if the program is going to terminate anyway. */ #ifdef UNREGISTER_ATFORK - UNREGISTER_ATFORK (d); + if (d != NULL) + UNREGISTER_ATFORK (d); #endif } |