summaryrefslogtreecommitdiffstats
path: root/threads.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-17 14:34:22 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-17 14:34:22 +0000
commit653ec62b23346eaab4f2f3830eeb7f1634a924c5 (patch)
treebea302747c51827905f2c8fc7eb8e4e243474149 /threads.c
parent8132d66186c8c08c44bb3504cb91e2e12bee11c1 (diff)
downloadrsyslog-653ec62b23346eaab4f2f3830eeb7f1634a924c5.tar.gz
rsyslog-653ec62b23346eaab4f2f3830eeb7f1634a924c5.tar.xz
rsyslog-653ec62b23346eaab4f2f3830eeb7f1634a924c5.zip
- implemented afterRun input module interface function
- implemented $klogSymbolsTwice config directive
Diffstat (limited to 'threads.c')
-rw-r--r--threads.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/threads.c b/threads.c
index 70271ab1..88b4ce8f 100644
--- a/threads.c
+++ b/threads.c
@@ -99,6 +99,10 @@ dbgprintf("Terminate thread %lx via method %d\n", pThis->thrdID, pThis->eTermToo
pthread_cancel(pThis->thrdID);
}
pThis->bIsActive = 0;
+
+ /* call cleanup function, if any */
+ if(pThis->pAfterRun != NULL)
+ pThis->pAfterRun(pThis);
return RS_RET_OK;
}
@@ -108,9 +112,7 @@ dbgprintf("Terminate thread %lx via method %d\n", pThis->thrdID, pThis->eTermToo
*/
rsRetVal thrdTerminateAll(void)
{
-dbgprintf("thrdTerminateAll in\n");
llDestroy(&llThrds);
-dbgprintf("thrdTerminateAll out\n");
return RS_RET_OK;
}
@@ -151,7 +153,7 @@ static void* thrdStarter(void *arg)
* executing threads. It is added at the end of the list.
* rgerhards, 2007-12-14
*/
-rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), eTermSyncType_t eTermSyncType)
+rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), eTermSyncType_t eTermSyncType, rsRetVal(*afterRun)(thrdInfo_t *))
{
DEFiRet;
thrdInfo_t *pThis;
@@ -163,6 +165,7 @@ rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), eTermSyncType_t eTermSync
pThis->eTermTool = eTermSyncType;
pThis->bIsActive = 1;
pThis->pUsrThrdMain = thrdMain;
+ pThis->pAfterRun = afterRun;
i = pthread_create(&pThis->thrdID, NULL, thrdStarter, pThis);
CHKiRet(llAppend(&llThrds, NULL, pThis));