diff options
author | Maxim Kuvyrkov <maxim@codesourcery.com> | 2012-08-13 19:31:00 -0700 |
---|---|---|
committer | Maxim Kuvyrkov <maxim@codesourcery.com> | 2012-08-13 19:31:00 -0700 |
commit | 51a9ba860ae3305d475f43f568e8fa51b8a53b6e (patch) | |
tree | 77e13975116d3ca0e7c98c2ec01a63a47988f221 /include | |
parent | cc184e11fe3d3624c0ff622e018abc608346a342 (diff) | |
download | glibc-51a9ba860ae3305d475f43f568e8fa51b8a53b6e.zip glibc-51a9ba860ae3305d475f43f568e8fa51b8a53b6e.tar.gz glibc-51a9ba860ae3305d475f43f568e8fa51b8a53b6e.tar.bz2 |
Add explicit acquire/release semantics to atomic_exchange_and_add.
Diffstat (limited to 'include')
-rw-r--r-- | include/atomic.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/include/atomic.h b/include/atomic.h index 3ccb46d..bc20772 100644 --- a/include/atomic.h +++ b/include/atomic.h @@ -198,8 +198,12 @@ /* Add VALUE to *MEM and return the old value of *MEM. */ -#ifndef atomic_exchange_and_add -# define atomic_exchange_and_add(mem, value) \ +#ifndef atomic_exchange_and_add_acq +# ifdef atomic_exchange_and_add +# define atomic_exchange_and_add_acq(mem, value) \ + atomic_exchange_and_add (mem, value) +# else +# define atomic_exchange_and_add_acq(mem, value) \ ({ __typeof (*(mem)) __atg6_oldval; \ __typeof (mem) __atg6_memp = (mem); \ __typeof (*(mem)) __atg6_value = (value); \ @@ -213,8 +217,18 @@ __atg6_oldval), 0)); \ \ __atg6_oldval; }) +# endif #endif +#ifndef atomic_exchange_and_add_rel +# define atomic_exchange_and_add_rel(mem, value) \ + atomic_exchange_and_add_acq(mem, value) +#endif + +#ifndef atomic_exchange_and_add +# define atomic_exchange_and_add(mem, value) \ + atomic_exchange_and_add_acq(mem, value) +#endif #ifndef catomic_exchange_and_add # define catomic_exchange_and_add(mem, value) \ |