diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/queue.c | 12 | ||||
-rw-r--r-- | runtime/rule.c | 1 |
2 files changed, 8 insertions, 5 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; } diff --git a/runtime/rule.c b/runtime/rule.c index 19239d61..0776e2dc 100644 --- a/runtime/rule.c +++ b/runtime/rule.c @@ -279,7 +279,6 @@ processBatch(rule_t *pThis, batch_t *pBatch) if(localRet != RS_RET_OK) { DBGPRINTF("processBatch: iRet %d returned from shouldProcessThisMessage, " "ignoring message\n", localRet); - pBatch->pElem[i].bFilterOK = 0; } if(pBatch->pElem[i].bFilterOK) { |