summary refs log tree commit diff
path: root/nptl/cleanup.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-12 00:14:16 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-12 00:14:16 +0000
commit6efd481484e5d8d47b834fd034dc62f4c036d2cf (patch)
treec4bd9e169d534ceaf83f4b3f6b7f034e0e1cb379 /nptl/cleanup.c
parent32b0da568de098fc2d62da7cf6a06ddbaba156d7 (diff)
downloadglibc-6efd481484e5d8d47b834fd034dc62f4c036d2cf.tar.gz
glibc-6efd481484e5d8d47b834fd034dc62f4c036d2cf.tar.xz
glibc-6efd481484e5d8d47b834fd034dc62f4c036d2cf.zip
Declare __pthread_unwind. Define __do_cancel to use it. Declare old cleanup handler installation functions.
Diffstat (limited to 'nptl/cleanup.c')
-rw-r--r--nptl/cleanup.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/nptl/cleanup.c b/nptl/cleanup.c
index a25b397f9c..2029fe2141 100644
--- a/nptl/cleanup.c
+++ b/nptl/cleanup.c
@@ -22,34 +22,26 @@
 
 
 void
-_pthread_cleanup_push (buffer, routine, arg)
-     struct _pthread_cleanup_buffer *buffer;
-     void (*routine) (void *);
-     void *arg;
+__cleanup_fct_attribute
+__pthread_register_cancel (__pthread_unwind_buf_t *buf)
 {
+  struct pthread_unwind_buf *ibuf = (struct pthread_unwind_buf *) buf;
   struct pthread *self = THREAD_SELF;
 
-  buffer->__routine = routine;
-  buffer->__arg = arg;
-  buffer->__prev = THREAD_GETMEM (self, cleanup);
+  /* Store old info.  */
+  ibuf->priv.data.prev = THREAD_GETMEM (self, cleanup_jmp_buf);
+  ibuf->priv.data.cleanup = THREAD_GETMEM (self, cleanup);
 
-  THREAD_SETMEM (self, cleanup, buffer);
+  /* Store the new cleanup handler info.  */
+  THREAD_SETMEM (self, cleanup_jmp_buf, buf);
 }
-strong_alias (_pthread_cleanup_push, __pthread_cleanup_push)
 
 
 void
-_pthread_cleanup_pop (buffer, execute)
-     struct _pthread_cleanup_buffer *buffer;
-     int execute;
+__cleanup_fct_attribute
+__pthread_unregister_cancel (__pthread_unwind_buf_t *buf)
 {
-  struct pthread *self __attribute ((unused)) = THREAD_SELF;
+  struct pthread_unwind_buf *ibuf = (struct pthread_unwind_buf *) buf;
 
-  THREAD_SETMEM (self, cleanup, buffer->__prev);
-
-  /* If necessary call the cleanup routine after we removed the
-     current cleanup block from the list.  */
-  if (execute)
-    buffer->__routine (buffer->__arg);
+  THREAD_SETMEM (THREAD_SELF, cleanup_jmp_buf, ibuf->priv.data.prev);
 }
-strong_alias (_pthread_cleanup_pop, __pthread_cleanup_pop)