mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-18 08:40:42 +01:00
action: refactor worker instance table handling
This commit is contained in:
parent
d849fd6d88
commit
09522af762
17
action.c
17
action.c
@ -1347,6 +1347,23 @@ processBatchMain(void *__restrict__ const pVoid,
|
||||
}
|
||||
|
||||
|
||||
/* remove an action worker instance from our table of
|
||||
* workers. To be called from worker handler (wti).
|
||||
*/
|
||||
void
|
||||
actionRemoveWorker(action_t *const __restrict__ pAction,
|
||||
void *const __restrict__ actWrkrData)
|
||||
{
|
||||
pAction->nWrkr--;
|
||||
for(int w = 0 ; w < pAction->wrkrDataTableSize ; ++w) {
|
||||
if(pAction->wrkrDataTable[w] == actWrkrData) {
|
||||
pAction->wrkrDataTable[w] = NULL;
|
||||
break; /* done */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* call the HUP handler for a given action, if such a handler is defined.
|
||||
* Note that the action must be able to service HUP requests concurrently
|
||||
* to any current doAction() processing.
|
||||
|
||||
1
action.h
1
action.h
@ -102,6 +102,7 @@ rsRetVal activateActions(void);
|
||||
rsRetVal actionNewInst(struct nvlst *lst, action_t **ppAction);
|
||||
rsRetVal actionProcessCnf(struct cnfobj *o);
|
||||
void actionCommitAllDirect(wti_t *pWti);
|
||||
void actionRemoveWorker(action_t *const pAction, void *const actWrkrData);
|
||||
|
||||
/* external data */
|
||||
extern int iActionNbr;
|
||||
|
||||
@ -356,19 +356,7 @@ wtiWorker(wti_t *__restrict__ const pThis)
|
||||
dbgprintf("wti %p, action %d, ptr %p\n", pThis, i, wrkrInfo->actWrkrData);
|
||||
if(wrkrInfo->actWrkrData != NULL) {
|
||||
pAction = wrkrInfo->pAction;
|
||||
|
||||
// TODO: move this to action.c/h
|
||||
pAction->nWrkr--;
|
||||
for(int w = 0 ; w < pAction->wrkrDataTableSize ; ++w) {
|
||||
if(pAction->wrkrDataTable[w] == wrkrInfo->actWrkrData) {
|
||||
pAction->wrkrDataTable[w] = NULL;
|
||||
break; /* done */
|
||||
}
|
||||
}
|
||||
DBGPRINTF("wti %p: action %d now has %d workers\n",
|
||||
pThis, pAction->iActionNbr, pAction->nWrkr);
|
||||
// end TODO
|
||||
|
||||
actionRemoveWorker(pAction, wrkrInfo->actWrkrData);
|
||||
pAction->pMod->mod.om.freeWrkrInstance(wrkrInfo->actWrkrData);
|
||||
if(pAction->isTransactional) {
|
||||
/* free iparam "cache" - we need to go through to max! */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user