aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2016-07-21 14:31:28 +0200
committerTorvald Riegel <triegel@redhat.com>2016-08-05 16:06:22 +0200
commitf0e3925bf3b8df6940c3346db17e42615979d458 (patch)
tree02a07de8dac49709b74b29c7d05490e3c56eeafd /include
parentcb864fe0ecb52bff2961bfaffd5823a49bfdff01 (diff)
downloadglibc-f0e3925bf3b8df6940c3346db17e42615979d458.zip
glibc-f0e3925bf3b8df6940c3346db17e42615979d458.tar.gz
glibc-f0e3925bf3b8df6940c3346db17e42615979d458.tar.bz2
Add atomic_exchange_relaxed.
* include/atomic.h (atomic_exchange_relaxed): New.
Diffstat (limited to 'include')
-rw-r--r--include/atomic.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/atomic.h b/include/atomic.h
index ad3db25..129ee24 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -588,6 +588,9 @@ void __atomic_link_error (void);
__atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
__ATOMIC_RELEASE, __ATOMIC_RELAXED); })
+# define atomic_exchange_relaxed(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_RELAXED); })
# define atomic_exchange_acquire(mem, desired) \
({ __atomic_check_size((mem)); \
__atomic_exchange_n ((mem), (desired), __ATOMIC_ACQUIRE); })
@@ -684,6 +687,12 @@ void __atomic_link_error (void);
*(expected) == __atg103_expected; })
# endif
+/* XXX Fall back to acquire MO because archs do not define a weaker
+ atomic_exchange. */
+# ifndef atomic_exchange_relaxed
+# define atomic_exchange_relaxed(mem, val) \
+ atomic_exchange_acq ((mem), (val))
+# endif
# ifndef atomic_exchange_acquire
# define atomic_exchange_acquire(mem, val) \
atomic_exchange_acq ((mem), (val))