diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-04-05 05:21:15 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-04-05 05:21:15 +0000 |
commit | b22d701bb72b928526efff83c019b912f469af72 (patch) | |
tree | 4474c99dbe6f90a380c378817307646f6f8eff5c /nptl/init.c | |
parent | 3242201746d74bfbccb8267f8b2e81a9478bf78b (diff) | |
download | glibc-b22d701bb72b928526efff83c019b912f469af72.zip glibc-b22d701bb72b928526efff83c019b912f469af72.tar.gz glibc-b22d701bb72b928526efff83c019b912f469af72.tar.bz2 |
Update.
2003-04-04 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/createthread.c (create_thread): Add some more
comments explaining when to set multiple_threads and when not.
* pthreadP.h: Define THREAD_ATOMIC_CMPXCHG_VAL and
THREAD_ATOMIC_BIT_SET if not already defined.
* sysdeps/i386/tls.h: Define THREAD_ATOMIC_CMPXCHG_VAL and
THREAD_ATOMIC_BIT_SET:
* sysdeps/x86_64/tls.h: Likewise.
* cleanup_defer.c (_pthread_cleanup_push_defer): Rewrite to use
THREAD_ATOMIC_CMPXCHG_VAL.
(_pthread_cleanup_pop_restore): Likewise.
* cancellation.c (__pthread_enable_asynccancel): Likewise.
(__pthread_enable_asynccancel_2): Likewise.
(__pthread_disable_asynccancel): Likewise.
* libc-cancellation.c (__libc_enable_asynccancel): Likewise.
(__libc_disable_asynccancel): Likewise.
* init.c (sigcancel_handler): Likewise.
* pthread_setcancelstate.c (__pthread_setcancelstate): Likewise.
* pthread_setcanceltype.c (__pthread_setcanceltype): Likewise.
Diffstat (limited to 'nptl/init.c')
-rw-r--r-- | nptl/init.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/nptl/init.c b/nptl/init.c index 9d557cc..7a6883f 100644 --- a/nptl/init.c +++ b/nptl/init.c @@ -135,20 +135,21 @@ sigcancel_handler (int sig __attribute ((unused))) { struct pthread *self = THREAD_SELF; + int oldval = THREAD_GETMEM (self, cancelhandling); while (1) { /* We are canceled now. When canceled by another thread this flag is already set but if the signal is directly send (internally or from another process) is has to be done here. */ - int oldval = THREAD_GETMEM (self, cancelhandling); int newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK; if (oldval == newval || (oldval & EXITING_BITMASK) != 0) /* Already canceled or exiting. */ break; - if (! atomic_compare_and_exchange_bool_acq (&self->cancelhandling, - newval, oldval)) + int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval, + oldval); + if (curval == oldval) { /* Set the return value. */ THREAD_SETMEM (self, result, PTHREAD_CANCELED); @@ -160,6 +161,8 @@ sigcancel_handler (int sig __attribute ((unused))) break; } + + oldval = curval; } } |