summaryrefslogtreecommitdiffstats
path: root/runtime/queue.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-11-05 12:24:29 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-11-05 12:24:29 +0100
commit9b2e8c53fd08950eb397de0aedbc40e49e5a701a (patch)
tree61c4deea01b373f84a4a5c372bcb2a002d218b37 /runtime/queue.c
parent28b174e73c0d70be1a285b8b54c8904c3670cc0b (diff)
downloadrsyslog-9b2e8c53fd08950eb397de0aedbc40e49e5a701a.tar.gz
rsyslog-9b2e8c53fd08950eb397de0aedbc40e49e5a701a.tar.bz2
rsyslog-9b2e8c53fd08950eb397de0aedbc40e49e5a701a.zip
refactor bShutdownImmediate handling
Diffstat (limited to 'runtime/queue.c')
-rw-r--r--runtime/queue.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/runtime/queue.c b/runtime/queue.c
index 952edb0f..5d9296b1 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -707,9 +707,14 @@ queueSwitchToEmergencyMode(qqueue_t *pThis, rsRetVal initiatingError)
pThis->qType = QUEUETYPE_DIRECT;
pThis->qConstruct = qConstructDirect;
pThis->qDestruct = qDestructDirect;
- pThis->qAdd = qAddDirect;
- pThis->qDel = qDelDirect;
- pThis->MultiEnq = qqueueMultiEnqObjDirect;
+ /* these entry points shall not be used in direct mode
+ To catch program errors, make us abort if that happens!
+ TODO: currently main q in direct mode WILL abort!
+ rgerhards, 2013-11-05
+ */
+ pThis->qAdd = NULL;
+ pThis->qDel = NULL;
+ pThis->MultiEnq = NULL;
if(pThis->pqParent != NULL) {
DBGOPRINT((obj_t*) pThis, "DA queue is in emergency mode, disabling DA in parent\n");
pThis->pqParent->bIsDA = 0;
@@ -983,7 +988,7 @@ static rsRetVal qAddDirect(qqueue_t *pThis, msg_t* pMsg, wti_t *pWti)
singleBatch.nElem = 1; /* there always is only one in direct mode */
singleBatch.pElem = &batchObj;
singleBatch.eltState = &batchState;
- iRet = pThis->pConsumer(pThis->pAction, &singleBatch, pWti, &pThis->bShutdownImmediate);
+ iRet = pThis->pConsumer(pThis->pAction, &singleBatch, pWti);
msgDestruct(&pMsg);
RETiRet;
@@ -1289,7 +1294,7 @@ finalize_it:
* to modify some parameters before the queue is actually started.
*/
rsRetVal qqueueConstruct(qqueue_t **ppThis, queueType_t qType, int iWorkerThreads,
- int iMaxQueueSize, rsRetVal (*pConsumer)(void*, batch_t*, wti_t*, int*))
+ int iMaxQueueSize, rsRetVal (*pConsumer)(void*, batch_t*, wti_t*))
{
DEFiRet;
qqueue_t *pThis;
@@ -1848,7 +1853,8 @@ ConsumerReg(qqueue_t *pThis, wti_t *pWti)
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &iCancelStateSave);
- CHKiRet(pThis->pConsumer(pThis->pAction, &pWti->batch, pWti, &pThis->bShutdownImmediate));
+ pWti->pbShutdownImmediate = &pThis->bShutdownImmediate;
+ CHKiRet(pThis->pConsumer(pThis->pAction, &pWti->batch, pWti));
/* we now need to check if we should deliberately delay processing a bit
* and, if so, do that. -- rgerhards, 2008-01-30
@@ -2070,9 +2076,14 @@ qqueueStart(qqueue_t *pThis) /* this is the ConstructionFinalizer */
case QUEUETYPE_DIRECT:
pThis->qConstruct = qConstructDirect;
pThis->qDestruct = qDestructDirect;
- pThis->qAdd = qAddDirect;
- pThis->qDel = qDelDirect;
- pThis->MultiEnq = qqueueMultiEnqObjDirect;
+ /* these entry points shall not be used in direct mode
+ To catch program errors, make us abort if that happens!
+ TODO: currently main q in direct mode WILL abort!
+ rgerhards, 2013-11-05
+ */
+ pThis->qAdd = NULL;
+ pThis->qDel = NULL;
+ pThis->MultiEnq = NULL;
break;
}