diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-04-27 17:49:06 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-04-27 17:49:06 +0200 |
commit | 4a5a3196fbe4e5a4e9f8dea49f916462adbf3098 (patch) | |
tree | df7750c93603d4a979188f3385c9fe4997072c7f /runtime/queue.c | |
parent | 9cf1756dc6c06682b32ed7a789ceb4254b5792df (diff) | |
parent | cbe2e3d44496ec7c6418e7e74ce917f2086a2947 (diff) | |
download | rsyslog-4a5a3196fbe4e5a4e9f8dea49f916462adbf3098.tar.gz rsyslog-4a5a3196fbe4e5a4e9f8dea49f916462adbf3098.tar.xz rsyslog-4a5a3196fbe4e5a4e9f8dea49f916462adbf3098.zip |
Merge branch 'v4-devel' into master
Conflicts:
runtime/Makefile.am
runtime/atomic.h
runtime/queue.c
runtime/queue.h
runtime/wti.c
runtime/wti.h
runtime/wtp.c
runtime/wtp.h
Diffstat (limited to 'runtime/queue.c')
-rw-r--r-- | runtime/queue.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/queue.c b/runtime/queue.c index b29ec7ac..bf2164a6 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -214,8 +214,8 @@ static inline void queueDrain(qqueue_t *pThis) BEGINfunc DBGOPRINT((obj_t*) pThis, "queue (type %d) will lose %d messages, destroying...\n", pThis->qType, pThis->iQueueSize); /* iQueueSize is not decremented by qDel(), so we need to do it ourselves */ - while(ATOMIC_DEC_AND_FETCH(pThis->iQueueSize) > 0) { - pThis->qDeq(pThis, &pUsr); + while(ATOMIC_DEC_AND_FETCH(&pThis->iQueueSize, &pThis->mutQueueSize) > 0) { + pThis->qDel(pThis, &pUsr); if(pUsr != NULL) { objDestruct(pUsr); } @@ -1226,6 +1226,8 @@ rsRetVal qqueueConstruct(qqueue_t **ppThis, queueType_t qType, int iWorkerThread break; } + INIT_ATOMIC_HELPER_MUT(pThis->mutQueueSize); + finalize_it: OBJCONSTRUCT_CHECK_SUCCESS_AND_CLEANUP RETiRet; @@ -2063,6 +2065,8 @@ CODESTARTobjDestruct(qqueue) pthread_cond_destroy(&pThis->belowFullDlyWtrMrk); pthread_cond_destroy(&pThis->belowLightDlyWtrMrk); + DESTROY_ATOMIC_HELPER_MUT(pThis->mutQueueSize); + /* type-specific destructor */ iRet = pThis->qDestruct(pThis); |