summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-19 18:26:10 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-19 18:26:10 +0000
commit4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061 (patch)
tree5d2a3274fca36375eb460f483d802db22c0fea5e /nptl
parent2c008571c3ad156479307b7e23185ae566b5776a (diff)
downloadglibc-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.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/semaphore.h17
-rw-r--r--nptl/sysdeps/pthread/pthread.h28
-rw-r--r--nptl/sysdeps/unix/sysv/linux/unregister-atfork.c20
3 files changed, 48 insertions, 17 deletions
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.  */