diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-07-02 05:13:15 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-07-02 05:13:15 +0000 |
commit | ca2b4cd7b1745f444682d81fbad1938e1ee051bd (patch) | |
tree | 8ebd1ac7c88f0dd82b7d22cd29fe5ccc07da9057 /nptl | |
parent | f036e569acd64504c92403e961b93b488a1c175a (diff) | |
download | glibc-ca2b4cd7b1745f444682d81fbad1938e1ee051bd.tar glibc-ca2b4cd7b1745f444682d81fbad1938e1ee051bd.tar.gz glibc-ca2b4cd7b1745f444682d81fbad1938e1ee051bd.tar.bz2 glibc-ca2b4cd7b1745f444682d81fbad1938e1ee051bd.zip |
Update.
2003-07-01 Ulrich Drepper <drepper@redhat.com>
* libc-cancellation.c (__libc_cleanup_routine): Define.
* sysdeps/pthread/bits/libc-lock.h (__pthread_cleanup_push): Define.
(__pthread_cleanup_pop): Define.
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/Banner | 2 | ||||
-rw-r--r-- | nptl/ChangeLog | 6 | ||||
-rw-r--r-- | nptl/libc-cancellation.c | 9 | ||||
-rw-r--r-- | nptl/sysdeps/pthread/bits/libc-lock.h | 21 |
4 files changed, 37 insertions, 1 deletions
diff --git a/nptl/Banner b/nptl/Banner index c1d46259e4..00dde3737e 100644 --- a/nptl/Banner +++ b/nptl/Banner @@ -1 +1 @@ -NPTL 0.50 by Ulrich Drepper +NPTL 0.51 by Ulrich Drepper diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 4a976c4555..82034f8d5d 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,9 @@ +2003-07-01 Ulrich Drepper <drepper@redhat.com> + + * libc-cancellation.c (__libc_cleanup_routine): Define. + * sysdeps/pthread/bits/libc-lock.h (__pthread_cleanup_push): Define. + (__pthread_cleanup_pop): Define. + 2003-07-01 Richard Henderson <rth@redhat.com> * sysdeps/alpha/elf/pt-initfini.c: New file. diff --git a/nptl/libc-cancellation.c b/nptl/libc-cancellation.c index 72a6d108fd..a68ee71450 100644 --- a/nptl/libc-cancellation.c +++ b/nptl/libc-cancellation.c @@ -21,6 +21,7 @@ #include <stdlib.h> #include "pthreadP.h" #include "atomic.h" +#include <bits/libc-lock.h> #ifndef NOT_IN_libc @@ -103,4 +104,12 @@ __libc_disable_asynccancel (int oldtype) } } + +void +__libc_cleanup_routine (struct __pthread_cleanup_frame *f) +{ + if (f->__do_it) + f->__cancel_routine (f->__cancel_arg); +} + #endif diff --git a/nptl/sysdeps/pthread/bits/libc-lock.h b/nptl/sysdeps/pthread/bits/libc-lock.h index 945a81cb82..48c4e89185 100644 --- a/nptl/sysdeps/pthread/bits/libc-lock.h +++ b/nptl/sysdeps/pthread/bits/libc-lock.h @@ -389,6 +389,27 @@ extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer } else if (DOIT) \ _buffer.__routine (_buffer.__arg) + +/* Normal cleanup handling, based on C cleanup attribute. */ +extern inline void +__libc_cleanup_routine (struct __pthread_cleanup_frame *f) +{ + if (f->__do_it) + f->__cancel_routine (f->__cancel_arg); +} + +#define __pthread_cleanup_push(fct, arg) \ + do { \ + struct __pthread_cleanup_frame __clframe \ + __attribute__ ((__cleanup__ (__libc_cleanup_routine))) \ + = { .__cancel_routine = (routine), .__cancel_arg = (arg), \ + .__do_it = 1 }; + +#define __pthread_cleanup_pop(execute) \ + __clframe.__do_it = (execute); \ + } while (0) + + /* Create thread-specific key. */ #define __libc_key_create(KEY, DESTRUCTOR) \ __libc_ptf_call (__pthread_key_create, (KEY, DESTRUCTOR), 1) |