diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-25 12:03:14 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-25 12:03:14 +0200 |
commit | d12b9e0c67cc72c9b1631bf2a5611d383e7ad69d (patch) | |
tree | 0e4d79a28d2ac8ed614575eeb4b7b00f9c3e04a3 /runtime/atomic.h | |
parent | db3d5edbe6ac016d99122deeb3da640d7d8864a2 (diff) | |
download | rsyslog-d12b9e0c67cc72c9b1631bf2a5611d383e7ad69d.tar.gz rsyslog-d12b9e0c67cc72c9b1631bf2a5611d383e7ad69d.tar.xz rsyslog-d12b9e0c67cc72c9b1631bf2a5611d383e7ad69d.zip |
some memory accesses are now explicitely atomic
... as far as I think this mostly is to keep the thread debuggers
happy
Diffstat (limited to 'runtime/atomic.h')
-rw-r--r-- | runtime/atomic.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/atomic.h b/runtime/atomic.h index fdf64214..f5ae9357 100644 --- a/runtime/atomic.h +++ b/runtime/atomic.h @@ -46,6 +46,11 @@ # define ATOMIC_DEC_AND_FETCH(data) __sync_sub_and_fetch(&(data), 1) # define ATOMIC_FETCH_32BIT(data) ((unsigned) __sync_fetch_and_and(&(data), 0xffffffff)) # define ATOMIC_STORE_1_TO_32BIT(data) __sync_lock_test_and_set(&(data), 1) +# define ATOMIC_STORE_0_TO_INT(data) __sync_fetch_and_and(&(data), 0) +# define ATOMIC_STORE_1_TO_INT(data) __sync_fetch_and_or(&(data), 1) +# define ATOMIC_STORE_INT_TO_INT(data, val) __sync_fetch_and_or(&(data), (val)) +# define ATOMIC_CAS(data, oldVal, newVal) __sync_bool_compare_and_swap(&(data), (oldVal), (newVal)); +# define ATOMIC_CAS_VAL(data, oldVal, newVal) __sync_val_compare_and_swap(&(data), (oldVal), (newVal)); #else /* note that we gained parctical proof that theoretical problems DO occur * if we do not properly address them. See this blog post for details: |