summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-09-18 10:49:16 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-09-18 10:49:16 +0200
commit988989e49ef8639123c83383ba256c4e67679c8d (patch)
treeb64f4b5f89edfeb7d3a9fcb0b21235ca96ebc3ef /runtime
parentcf8b0717e12330695ce2e4b16966fda2a64b053e (diff)
downloadrsyslog-988989e49ef8639123c83383ba256c4e67679c8d.tar.gz
rsyslog-988989e49ef8639123c83383ba256c4e67679c8d.tar.xz
rsyslog-988989e49ef8639123c83383ba256c4e67679c8d.zip
re-enabled gcc builtin atomic operations and added a proper ./configure check
Diffstat (limited to 'runtime')
-rw-r--r--runtime/atomic.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/runtime/atomic.h b/runtime/atomic.h
index 430ae7f0..d6811628 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -1,6 +1,6 @@
/* This header supplies atomic operations. So far, we rely on GCC's
- * atomic builtins. I have no idea if we can check them via autotools,
- * but I am making the necessary provisioning to live without them if
+ * atomic builtins. During configure, we check if atomic operatons are
+ * available. If they are not, I am making the necessary provisioning to live without them if
* they are not available. Please note that you should only use the macros
* here if you think you can actually live WITHOUT an explicit atomic operation,
* because in the non-presence of them, we simply do it without atomicitiy.
@@ -36,16 +36,16 @@
#ifndef INCLUDED_ATOMIC_H
#define INCLUDED_ATOMIC_H
-/* set the following to 1 if we have atomic operations (and #undef it otherwise) */
-/* #define DO_HAVE_ATOMICS 1 */
/* for this release, we disable atomic calls because there seem to be some
* portability problems and we can not fix that without destabilizing the build.
* They simply came in too late. -- rgerhards, 2008-04-02
*/
-/* make sure they are not used!
-#define ATOMIC_INC(data) ((void) __sync_fetch_and_add(&data, 1))
-#define ATOMIC_DEC_AND_FETCH(data) __sync_sub_and_fetch(&data, 1)
-*/
-#define ATOMIC_INC(data) (++(data))
+#ifdef HAVE_ATOMIC_BUILTINS
+# define ATOMIC_INC(data) ((void) __sync_fetch_and_add(&data, 1))
+# define ATOMIC_DEC_AND_FETCH(data) __sync_sub_and_fetch(&data, 1)
+#else
+# warning "atomic builtins not available, using nul operations"
+# define ATOMIC_INC(data) (++(data))
+#endif
#endif /* #ifndef INCLUDED_ATOMIC_H */