summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-06-24 14:01:05 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2010-06-24 14:01:05 +0200
commit0d721450eb9dca0cc5051c7ac9d2570685cce7e5 (patch)
tree9ad4f4e81aeeaa8cb7379c7c9b407fd97723b029 /runtime
parent31fae7b93d7aa94b7b3fcbfdf101328230ea6302 (diff)
downloadrsyslog-0d721450eb9dca0cc5051c7ac9d2570685cce7e5.tar.gz
rsyslog-0d721450eb9dca0cc5051c7ac9d2570685cce7e5.tar.xz
rsyslog-0d721450eb9dca0cc5051c7ac9d2570685cce7e5.zip
added missing support for systems without atomic instructions
Diffstat (limited to 'runtime')
-rw-r--r--runtime/atomic.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/atomic.h b/runtime/atomic.h
index da0852fa..da544c4b 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -91,6 +91,21 @@
}
static inline int
+ ATOMIC_CAS(int *data, int oldVal, int newVal, pthread_mutex_t *phlpmut) {
+ int bSuccess;
+ pthread_mutex_lock(phlpmut);
+ if(*data == oldVal) {
+ *data = newVal;
+ bSuccess = 1;
+ } else {
+ bSuccess = 0;
+ }
+ pthread_mutex_unlock(phlpmut);
+ return(bSuccess);
+ }
+
+
+ static inline int
ATOMIC_CAS_VAL(int *data, int oldVal, int newVal, pthread_mutex_t *phlpmut) {
int val;
pthread_mutex_lock(phlpmut);