diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-09-22 05:45:50 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-09-22 05:45:50 +0000 |
commit | bc1989aad2a5246ea5d216546240609620451f87 (patch) | |
tree | d708ff3f97c49951c713cd6253ba8ceabcbcfa05 /nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h | |
parent | 3a226d33012ec69a480ddb58940f2aaa3e24f059 (diff) | |
download | glibc-bc1989aad2a5246ea5d216546240609620451f87.tar.gz glibc-bc1989aad2a5246ea5d216546240609620451f87.tar.xz glibc-bc1989aad2a5246ea5d216546240609620451f87.zip |
Update.
* sysdeps/unix/sysv/linux/ia64/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/lowlevellock.c: Likewise. * sysdeps/pthread/pthread_cond_signal.c: Don't use requeue.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h index a987accbed..0caee0cd1f 100644 --- a/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/lowlevellock.h @@ -106,34 +106,25 @@ extern void __lll_lock_wait (int *futex, int val) attribute_hidden; #define lll_mutex_lock(lock) \ (void) ({ \ int *__futex = &(lock); \ - int __val = atomic_exchange_and_add (__futex, 1); \ - __asm __volatile (__lll_acq_instr ::: "memory"); \ - if (__builtin_expect (__val != 0, 0)) \ - __lll_lock_wait (__futex, __val); \ + if (atomic_compare_and_exchange_bool_acq (__futex, 1, 0) != 0) \ + __lll_lock_wait (__futex); \ }) #define lll_mutex_cond_lock(lock) \ (void) ({ \ int *__futex = &(lock); \ - int __val = atomic_exchange_and_add (__futex, 2); \ - __asm __volatile (__lll_acq_instr ::: "memory"); \ - if (__builtin_expect (__val != 0, 0)) \ - /* Note, the val + 1 is kind of ugly here. __lll_lock_wait will add \ - 1 again. But we added 2 to the futex value so this is the right \ - value which will be passed to the kernel. */ \ - __lll_lock_wait (__futex, __val + 1); \ + if (atomic_compare_and_exchange_bool_acq (__futex, 2, 0) != 0) \ + __lll_lock_wait (__futex); \ }) extern int __lll_timedlock_wait (int *futex, int val, const struct timespec *) attribute_hidden; #define lll_mutex_timedlock(lock, abstime) \ - ({ int *__futex = &(lock); \ - int __val = atomic_exchange_and_add (__futex, 1); \ - __asm __volatile (__lll_acq_instr ::: "memory"); \ - if (__builtin_expect (__val != 0, 0)) \ - __val = __lll_timedlock_wait (__futex, __val, (abstime)); \ - __val; \ + (void) ({ \ + int *__futex = &(lock); \ + if (atomic_compare_and_exchange_bool_acq (__futex, 1, 0) != 0) \ + __lll_timedlock_wait (__futex, abstime); \ }) #define lll_mutex_unlock(lock) \ |