summaryrefslogtreecommitdiffstats
path: root/runtime/rsyslog.c
diff options
context:
space:
mode:
authorSteffen Sledz <sledz@dresearch.de>2010-03-19 16:56:38 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-03-23 11:11:30 +0100
commita61e164a977ff17b90f9a301dacbc5a01aca7e7e (patch)
treef94bc053af5166404d5ad7a914cf03dc2b611948 /runtime/rsyslog.c
parentc802afb7e0fc5e2c87af24e12bf63e4a0ba7688c (diff)
downloadrsyslog-a61e164a977ff17b90f9a301dacbc5a01aca7e7e.tar.gz
rsyslog-a61e164a977ff17b90f9a301dacbc5a01aca7e7e.tar.xz
rsyslog-a61e164a977ff17b90f9a301dacbc5a01aca7e7e.zip
emulate missing atomic builtins with posix semaphores if available
Signed-off-by: Steffen Sledz <sledz@dresearch.de> Acked-by: Thilo Fromm <t.fromm@dresearch.de>
Diffstat (limited to 'runtime/rsyslog.c')
-rw-r--r--runtime/rsyslog.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/rsyslog.c b/runtime/rsyslog.c
index a76ae25a..921ad0bd 100644
--- a/runtime/rsyslog.c
+++ b/runtime/rsyslog.c
@@ -81,6 +81,7 @@
#include "rule.h"
#include "ruleset.h"
#include "parser.h"
+#include "atomic.h"
/* forward definitions */
static rsRetVal dfltErrLogger(int, uchar *errMsg);
@@ -140,6 +141,12 @@ rsrtInit(char **ppErrObj, obj_if_t *pObjIF)
CHKiRet(objClassInit(NULL)); /* *THIS* *MUST* always be the first class initilizer being called! */
CHKiRet(objGetObjInterface(pObjIF)); /* this provides the root pointer for all other queries */
+#ifndef HAVE_ATOMIC_BUILTINS
+#ifdef HAVE_SEMAPHORE_H
+ CHKiRet(atomicSemInit());
+#endif /* HAVE_SEMAPHORE_H */
+#endif /* !defined(HAVE_ATOMIC_BUILTINS) */
+
/* initialize core classes. We must be very careful with the order of events. Some
* classes use others and if we do not initialize them in the right order, we may end
* up with an invalid call. The most important thing that can happen is that an error
@@ -216,6 +223,13 @@ rsrtExit(void)
glblClassExit();
rulesetClassExit();
ruleClassExit();
+
+#ifndef HAVE_ATOMIC_BUILTINS
+#ifdef HAVE_SEMAPHORE_H
+ atomicSemExit();
+#endif /* HAVE_SEMAPHORE_H */
+#endif /* !defined(HAVE_ATOMIC_BUILTINS) */
+
objClassExit(); /* *THIS* *MUST/SHOULD?* always be the first class initilizer being called (except debug)! */
}