summaryrefslogtreecommitdiffstats
path: root/runtime/atomic.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-25 11:06:42 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-25 11:06:42 +0200
commit46024834449840dabf399dda196c9dd11cf78ace (patch)
tree36dc3dc8f85d756afea2924398d5deb679852026 /runtime/atomic.h
parentc60cbd99df4710545587659be6344392e99745ff (diff)
downloadrsyslog-46024834449840dabf399dda196c9dd11cf78ace.tar.gz
rsyslog-46024834449840dabf399dda196c9dd11cf78ace.tar.xz
rsyslog-46024834449840dabf399dda196c9dd11cf78ace.zip
added a few atomic operations
mostly to get thread debugger errors clean (plus, of course, it makes things more deterministic)
Diffstat (limited to 'runtime/atomic.h')
-rw-r--r--runtime/atomic.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/atomic.h b/runtime/atomic.h
index fdf64214..4cb832f2 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -46,6 +46,10 @@
# 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));
#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: