diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-09-15 15:17:47 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-09-15 15:17:47 +0200 |
commit | 1d0e4ba3b34464343c388ccef3ca8b08df42076a (patch) | |
tree | d17f746f7c8cb2f00aa3ab956740fd616e2390c0 /runtime/prop.c | |
parent | b7e69a240037277e77685af5ea5623cdd89ec2d2 (diff) | |
parent | 11ee5cbdfb08ba3e42a853c08144fa24cd55d6da (diff) | |
download | rsyslog-1d0e4ba3b34464343c388ccef3ca8b08df42076a.tar.gz rsyslog-1d0e4ba3b34464343c388ccef3ca8b08df42076a.tar.bz2 rsyslog-1d0e4ba3b34464343c388ccef3ca8b08df42076a.zip |
Merge branch 'v4-stable' of git+ssh://git.adiscon.com/git/rsyslog into v4-stable
Diffstat (limited to 'runtime/prop.c')
-rw-r--r-- | runtime/prop.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/prop.c b/runtime/prop.c index d188b2ed..7f2a56ff 100644 --- a/runtime/prop.c +++ b/runtime/prop.c @@ -53,6 +53,7 @@ DEFobjStaticHelpers */ BEGINobjConstruct(prop) /* be sure to specify the object type also in END macro! */ pThis->iRefCount = 1; + INIT_ATOMIC_HELPER_MUT(pThis->mutRefCount); ENDobjConstruct(prop) @@ -60,11 +61,12 @@ ENDobjConstruct(prop) BEGINobjDestruct(prop) /* be sure to specify the object type also in END and CODESTART macros! */ int currRefCount; CODESTARTobjDestruct(prop) - currRefCount = ATOMIC_DEC_AND_FETCH(pThis->iRefCount); + currRefCount = ATOMIC_DEC_AND_FETCH(&pThis->iRefCount, &pThis->mutRefCount); if(currRefCount == 0) { /* (only) in this case we need to actually destruct the object */ if(pThis->len >= CONF_PROP_BUFSIZE) free(pThis->szVal.psz); + DESTROY_ATOMIC_HELPER_MUT(pThis->mutRefCount); } else { pThis = NULL; /* tell framework NOT to destructing the object! */ } @@ -132,7 +134,7 @@ propConstructFinalize(prop_t __attribute__((unused)) *pThis) */ static rsRetVal AddRef(prop_t *pThis) { - ATOMIC_INC(pThis->iRefCount); + ATOMIC_INC(&pThis->iRefCount, &pThis->mutRefCount); return RS_RET_OK; } |