diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-06-21 15:11:21 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-06-21 15:11:21 +0200 |
commit | 242c263dc2eaa5c148d481503dae0498ee626103 (patch) | |
tree | 3d64994a124fdc5b9346c4bfef4e4d8938d50603 /runtime/queue.c | |
parent | d5f78989d8fd2a3c11fd1e6ed1cd4d688b1e6728 (diff) | |
parent | 86225089f2d0e82deb368e1688464e8ba84d24cf (diff) | |
download | rsyslog-242c263dc2eaa5c148d481503dae0498ee626103.tar.gz rsyslog-242c263dc2eaa5c148d481503dae0498ee626103.tar.xz rsyslog-242c263dc2eaa5c148d481503dae0498ee626103.zip |
Merge branch 'v5-stable' into v5-devel
Conflicts:
ChangeLog
configure.ac
doc/manual.html
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 d31a4551..c831836d 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -1721,6 +1721,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); @@ -1741,6 +1742,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); @@ -1760,12 +1762,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; } |