From 6efd481484e5d8d47b834fd034dc62f4c036d2cf Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 12 Apr 2003 00:14:16 +0000 Subject: Declare __pthread_unwind. Define __do_cancel to use it. Declare old cleanup handler installation functions. --- nptl/cleanup.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'nptl/cleanup.c') 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) -- cgit v1.2.1