summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-02-17 16:18:21 +0000
committerJakub Jelinek <jakub@redhat.com>2006-02-17 16:18:21 +0000
commit378b1353df56387b0706bc42cb661ff2227c8eb9 (patch)
treedb9a2d7dc4e6efe53f633f0fcda52f682f16f3a9 /include
parent9c09cd93597a91d6b0b59c8813be97d530e7551c (diff)
* include/atomic.h (atomic_and, atomic_or): Define.cvs/fedora-glibc-2_3_90-38
nptl/ * sysdeps/unix/sysv/linux/alpha/lowlevellock.h (lll_robust_mutex_dead, lll_robust_mutex_trylock, lll_robust_mutex_lock, lll_robust_mutex_cond_lock, lll_robust_mutex_timedlock, lll_robust_mutex_unlock): New macros. (__lll_robust_lock_wait, __lll_robust_timedlock_wait): New prototypes. * sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/ia64/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/lowlevelrobustlock.c: New file.
Diffstat (limited to 'include')
-rw-r--r--include/atomic.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/include/atomic.h b/include/atomic.h
index 8b76435a81..a1598e3850 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -1,5 +1,5 @@
/* Internal macros for atomic operations for GNU C Library.
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -273,6 +273,41 @@
__oldval & __mask; })
#endif
+/* Atomically *mem &= mask and return the old value of *mem. */
+#ifndef atomic_and
+# define atomic_and(mem, mask) \
+ ({ __typeof (*(mem)) __oldval; \
+ __typeof (mem) __memp = (mem); \
+ __typeof (*(mem)) __mask = (mask); \
+ \
+ do \
+ __oldval = (*__memp); \
+ while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
+ __oldval \
+ & __mask, \
+ __oldval),\
+ 0)); \
+ \
+ __oldval; })
+#endif
+
+/* Atomically *mem |= mask and return the old value of *mem. */
+#ifndef atomic_or
+# define atomic_or(mem, mask) \
+ ({ __typeof (*(mem)) __oldval; \
+ __typeof (mem) __memp = (mem); \
+ __typeof (*(mem)) __mask = (mask); \
+ \
+ do \
+ __oldval = (*__memp); \
+ while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
+ __oldval \
+ | __mask, \
+ __oldval),\
+ 0)); \
+ \
+ __oldval; })
+#endif
#ifndef atomic_full_barrier
# define atomic_full_barrier() __asm ("" ::: "memory")