summaryrefslogtreecommitdiffstats
path: root/runtime/msg.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-01-29 11:58:26 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-01-29 11:58:26 +0100
commit14d5cc7f55ffc7980c0bb73f50b53da175271358 (patch)
tree1ae6ead0da00f75ad288b5e238c527673b57a651 /runtime/msg.c
parent4c7ab3bcc6db2aaddd0515944f282e3dd6ab056a (diff)
downloadrsyslog-14d5cc7f55ffc7980c0bb73f50b53da175271358.tar.gz
rsyslog-14d5cc7f55ffc7980c0bb73f50b53da175271358.tar.xz
rsyslog-14d5cc7f55ffc7980c0bb73f50b53da175271358.zip
fixed atomic operations
Diffstat (limited to 'runtime/msg.c')
-rw-r--r--runtime/msg.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 2e2d41ad..cf291b5d 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -328,14 +328,13 @@ finalize_it:
BEGINobjDestruct(msg) /* be sure to specify the object type also in END and CODESTART macros! */
int currRefCount;
CODESTARTobjDestruct(msg)
- /* DEV Debugging only ! dbgprintf("msgDestruct\t0x%lx, Ref now: %d\n", (unsigned long)pM, pM->iRefCount - 1); */
-//# ifdef DO_HAVE_ATOMICS
-// currRefCount = ATOMIC_DEC_AND_FETCH(pThis->iRefCount);
-//# else
+ /* DEV Debugging only ! dbgprintf("msgDestruct\t0x%lx, Ref now: %d\n", (unsigned long)pThis, pThis->iRefCount - 1); */
+# ifdef HAVE_ATOMIC_BUILTINS
+ currRefCount = ATOMIC_DEC_AND_FETCH(pThis->iRefCount);
+# else
MsgLock(pThis);
currRefCount = --pThis->iRefCount;
-//# endif
-// we need a mutex, because we may be suspended after getting the refcount but before
+# endif
if(currRefCount == 0)
{
/* DEV Debugging Only! dbgprintf("msgDestruct\t0x%lx, RefCount now 0, doing DESTROY\n", (unsigned long)pThis); */