diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-01-30 13:41:31 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-01-30 13:41:31 +0100 |
commit | 77b363fb4e6785cebfaec1a6bb235389d34ee4b9 (patch) | |
tree | ca1303835fab294b15c8c964e4df90861f46cde2 | |
parent | 82d7abc1f4b03f37ff94c5f184d49502b6cf489b (diff) | |
parent | 5453699428b8f5a7dd6ac23abe7b838dd19101b5 (diff) | |
download | rsyslog-77b363fb4e6785cebfaec1a6bb235389d34ee4b9.tar.gz rsyslog-77b363fb4e6785cebfaec1a6bb235389d34ee4b9.tar.xz rsyslog-77b363fb4e6785cebfaec1a6bb235389d34ee4b9.zip |
Merge branch 'debian_lenny' into v3-stable
-rw-r--r-- | runtime/msg.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 064ed44b..d02b0a04 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -274,11 +274,8 @@ BEGINobjDestruct(msg) /* be sure to specify the object type also in END and CODE 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 - currRefCount = --pThis->iRefCount; -# endif + MsgLock(pThis); + currRefCount = --pThis->iRefCount; if(currRefCount == 0) { /* DEV Debugging Only! dbgprintf("msgDestruct\t0x%lx, RefCount now 0, doing DESTROY\n", (unsigned long)pThis); */ @@ -336,8 +333,10 @@ CODESTARTobjDestruct(msg) rsCStrDestruct(&pThis->pCSPROCID); if(pThis->pCSMSGID != NULL) rsCStrDestruct(&pThis->pCSMSGID); + MsgUnlock(pThis); funcDeleteMutex(pThis); } else { + MsgUnlock(pThis); pThis = NULL; /* tell framework not to destructing the object! */ } ENDobjDestruct(msg) @@ -481,13 +480,9 @@ finalize_it: msg_t *MsgAddRef(msg_t *pM) { assert(pM != NULL); -# ifdef DO_HAVE_ATOMICS - ATOMIC_INC(pM->iRefCount); -# else - MsgLock(pM); - pM->iRefCount++; - MsgUnlock(pM); -# endif + MsgLock(pM); + pM->iRefCount++; + MsgUnlock(pM); /* DEV debugging only! dbgprintf("MsgAddRef\t0x%x done, Ref now: %d\n", (int)pM, pM->iRefCount);*/ return(pM); } |