From 8d186b303650c1d942543e28fdf8cf28a451f438 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 14 Dec 2007 17:34:54 +0000 Subject: first rough version of input module thread termination --- threads.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'threads.c') diff --git a/threads.c b/threads.c index d58a291f..96911403 100644 --- a/threads.c +++ b/threads.c @@ -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; -- cgit v1.2.3