diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-07-24 11:38:01 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-07-24 11:38:01 +0200 |
commit | 7c1ad1c77cc3884931bd2c9e2d2f45db892a15a0 (patch) | |
tree | 4bf26b42e0157d62ac70c38bd783a3b35e83ecc3 /runtime/queue.c | |
parent | 0253f5ea381d1ff5da162359e16ec7c010fc18a3 (diff) | |
parent | f043778bdc23c7b2baf18c1fc35ba47fa4d8386c (diff) | |
download | rsyslog-7c1ad1c77cc3884931bd2c9e2d2f45db892a15a0.tar.gz rsyslog-7c1ad1c77cc3884931bd2c9e2d2f45db892a15a0.tar.xz rsyslog-7c1ad1c77cc3884931bd2c9e2d2f45db892a15a0.zip |
Merge branch 'v5-stable' into v6-stable
Diffstat (limited to 'runtime/queue.c')
-rw-r--r-- | runtime/queue.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/runtime/queue.c b/runtime/queue.c index d78ab2e3..280ebd94 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -1743,6 +1743,7 @@ ConsumerDA(qqueue_t *pThis, wti_t *pWti) { int i; int iCancelStateSave; + int bNeedReLock = 0; /**< do we need to lock the mutex again? */ DEFiRet; ISOBJ_TYPE_assert(pThis, qqueue); @@ -1752,6 +1753,7 @@ ConsumerDA(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); @@ -1770,10 +1772,10 @@ ConsumerDA(qqueue_t *pThis, wti_t *pWti) /* but now cancellation is no longer permitted */ pthread_setcancelstate(iCancelStateSave, NULL); - /* now we are done, but need to re-aquire the mutex */ - d_pthread_mutex_lock(pThis->mut); - finalize_it: + /* now we are done, but potentially need to re-aquire the mutex */ + if(bNeedReLock) + d_pthread_mutex_lock(pThis->mut); DBGOPRINT((obj_t*) pThis, "DAConsumer returns with iRet %d\n", iRet); RETiRet; } |