diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-06-21 15:42:11 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-06-21 15:42:11 +0200 |
commit | b71ef4abad365f95cf7adf3df14083940d531f1f (patch) | |
tree | c5744b7c3adb4e7ede7a282949cbfe41e414c813 /runtime/queue.c | |
parent | b1a905c5eb7833d661be4a910697f49deb34c640 (diff) | |
parent | 86225089f2d0e82deb368e1688464e8ba84d24cf (diff) | |
download | rsyslog-b71ef4abad365f95cf7adf3df14083940d531f1f.tar.gz rsyslog-b71ef4abad365f95cf7adf3df14083940d531f1f.tar.bz2 rsyslog-b71ef4abad365f95cf7adf3df14083940d531f1f.zip |
Merge branch 'v5-stable' into beta
Conflicts:
ChangeLog
configure.ac
doc/manual.html
tests/diag.sh
tests/sndrcv_drvr.sh
Diffstat (limited to 'runtime/queue.c')
-rw-r--r-- | runtime/queue.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/queue.c b/runtime/queue.c index 88e01a7a..00eb76c7 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -1678,6 +1678,7 @@ static rsRetVal ConsumerReg(qqueue_t *pThis, wti_t *pWti) { int iCancelStateSave; + int bNeedReLock = 0; /**< do we need to lock the mutex again? */ DEFiRet; ISOBJ_TYPE_assert(pThis, qqueue); @@ -1687,6 +1688,7 @@ ConsumerReg(qqueue_t *pThis, wti_t *pWti) /* we now have a non-idle batch of work, so we can release the queue mutex and process it */ d_pthread_mutex_unlock(pThis->mut); + bNeedReLock = 1; /* at this spot, we may be cancelled */ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &iCancelStateSave); @@ -1706,12 +1708,14 @@ ConsumerReg(qqueue_t *pThis, wti_t *pWti) /* but now cancellation is no longer permitted */ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave); - /* now we are done, but need to re-aquire the mutex */ - d_pthread_mutex_lock(pThis->mut); - finalize_it: - dbgprintf("regular consumer finished, iret=%d, szlog %d sz phys %d\n", iRet, + DBGPRINTF("regular consumer finished, iret=%d, szlog %d sz phys %d\n", iRet, getLogicalQueueSize(pThis), getPhysicalQueueSize(pThis)); + + /* now we are done, but potentially need to re-aquire the mutex */ + if(bNeedReLock) + d_pthread_mutex_lock(pThis->mut); + RETiRet; } |