aboutsummaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-05 07:10:33 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-05 07:10:33 +0000
commitd45e874013d6c45bb5b77a4022555e72357eddcb (patch)
tree6388a8ed93b9698db544e19a82a4e462945007df /nptl
parent0289bef9a684e08661b03803b61524d6dab9ffdc (diff)
downloadglibc-d45e874013d6c45bb5b77a4022555e72357eddcb.tar
glibc-d45e874013d6c45bb5b77a4022555e72357eddcb.tar.gz
glibc-d45e874013d6c45bb5b77a4022555e72357eddcb.tar.bz2
glibc-d45e874013d6c45bb5b77a4022555e72357eddcb.zip
Update.
* atomic.h (atomic_compare_and_exchange_acq): Use __arch_compare_and_exchange_32_acq in return value definition. It always exists. (atomic_bit_set): Renamed from atomic_set_bit.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog5
-rw-r--r--nptl/atomic.h16
2 files changed, 12 insertions, 9 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 542b102f78..f018cccbb3 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,6 +1,9 @@
2003-02-04 Ulrich Drepper <drepper@redhat.com>
- * atomic.h (atomic_bit_set): Renamed from atomic_set_bit.
+ * atomic.h (atomic_compare_and_exchange_acq): Use
+ __arch_compare_and_exchange_32_acq in return value definition. It
+ always exists.
+ (atomic_bit_set): Renamed from atomic_set_bit.
Add missing atomic_ prefixes.
* sysdeps/pthread/bits/libc-lock.h (__libc_once): In case no
diff --git a/nptl/atomic.h b/nptl/atomic.h
index fe390ddf78..c8ea95f834 100644
--- a/nptl/atomic.h
+++ b/nptl/atomic.h
@@ -27,7 +27,7 @@
#ifndef atomic_compare_and_exchange_acq
# define atomic_compare_and_exchange_acq(mem, newval, oldval) \
- ({ __typeof (__arch_compare_and_exchange_8_acq (mem, newval, oldval)) \
+ ({ __typeof (__arch_compare_and_exchange_32_acq (mem, newval, oldval)) \
__result; \
if (sizeof (*mem) == 1) \
__result = __arch_compare_and_exchange_8_acq (mem, newval, oldval); \
@@ -82,14 +82,14 @@
#ifndef atomic_bit_set
# define atomic_bit_set(mem, bit) \
(void) ({ __typeof (mem) __memp = (mem); \
- while (1) \
- { \
- __typeof (*mem) __oldval = *__memp; \
+ __typeof (*mem) __mask = (1 << (bit)); \
+ __typeof (*mem) __oldval; \
\
- if (atomic_compare_and_exchange_acq (__memp, \
- __oldval | 1 << bit, \
- __oldval) == 0) \
- break; \
+ do \
+ __oldval = *__memp; \
+ while (atomic_compare_and_exchange_acq (__memp, \
+ __oldval | __mask, \
+ __oldval)); \
}})
#endif