diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-12-14 17:34:54 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-12-14 17:34:54 +0000 |
commit | 8d186b303650c1d942543e28fdf8cf28a451f438 (patch) | |
tree | 8cddcb4d3eca34f451c9c11edc23513eb51cb668 /threads.c | |
parent | 3a209d530568ddfb448d3b55e506022245e394b4 (diff) | |
download | rsyslog-8d186b303650c1d942543e28fdf8cf28a451f438.tar.gz rsyslog-8d186b303650c1d942543e28fdf8cf28a451f438.tar.xz rsyslog-8d186b303650c1d942543e28fdf8cf28a451f438.zip |
first rough version of input module thread termination
Diffstat (limited to 'threads.c')
-rw-r--r-- | threads.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -71,6 +71,7 @@ static rsRetVal thrdConstruct(thrdInfo_t **pThis) static rsRetVal thrdDestruct(thrdInfo_t *pThis) { assert(pThis != NULL); +dbgprintf("thrdDestruct, pThis: %lx\n", pThis); if(pThis->bIsActive == 1) { thrdTerminate(pThis); @@ -88,6 +89,7 @@ rsRetVal thrdTerminate(thrdInfo_t *pThis) { assert(pThis != NULL); +dbgprintf("Terminate thread %d via method %d\n", pThis->thrdID, pThis->eTermTool); if(pThis->eTermTool == eTermSync_SIGNAL) { pthread_kill(pThis->thrdID, SIGUSR2); pthread_join(pThis->thrdID, NULL); @@ -101,6 +103,17 @@ rsRetVal thrdTerminate(thrdInfo_t *pThis) } +/* terminate all known threads gracefully. + */ +rsRetVal thrdTerminateAll(void) +{ +dbgprintf("thrdTerminateAll in\n"); + llDestroy(&llThrds); +dbgprintf("thrdTerminateAll out\n"); + return RS_RET_OK; +} + + /* Start a new thread and add it to the list of currently * executing threads. It is added at the end of the list. * rgerhards, 2007-12-14 @@ -115,6 +128,7 @@ rsRetVal thrdCreate(void* (*thrdMain)(void*)) CHKiRet(thrdConstruct(&pThis)); i = pthread_create(&pThis->thrdID, NULL, thrdMain, NULL); + CHKiRet(llAppend(&llThrds, NULL, pThis)); finalize_it: return iRet; |