diff options
Diffstat (limited to 'nptl/cleanup.c')
-rw-r--r-- | nptl/cleanup.c | 32 |
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) |