diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-10 14:27:26 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-10 14:27:26 +0000 |
commit | 28c44e9a7bf4f99279af94a96bac42d0379b27d0 (patch) | |
tree | 7f66af0893f092d3212e3e34218d41973a3fe2cc /threads.c | |
parent | 4c24b427954166689b58562d68fefcfda7439ace (diff) | |
download | rsyslog-28c44e9a7bf4f99279af94a96bac42d0379b27d0.tar.gz rsyslog-28c44e9a7bf4f99279af94a96bac42d0379b27d0.tar.xz rsyslog-28c44e9a7bf4f99279af94a96bac42d0379b27d0.zip |
- fixed a bug that caused a segfault on startup when no $WorkDir directivev3-10-1a
was specified in rsyslog.conf
- fixed a bug that caused a segfault on queues with types other than "disk"
- removed the now longer needed thread TermSyncTool
Diffstat (limited to 'threads.c')
-rw-r--r-- | threads.c | 25 |
1 files changed, 5 insertions, 20 deletions
@@ -86,29 +86,15 @@ static rsRetVal thrdDestruct(thrdInfo_t *pThis) } -/* terminate a thread gracefully. It's termination sync state is taken into - * account. +/* terminate a thread gracefully. */ rsRetVal thrdTerminate(thrdInfo_t *pThis) { assert(pThis != NULL); -dbgprintf("Terminate thread %lx via method %d\n", pThis->thrdID, pThis->eTermTool); - if(pThis->eTermTool == eTermSync_SIGNAL) { - /* we first wait for the thread to reach a point in execution where it - * is safe to terminate it. - * TODO: TIMEOUT! - */ - pthread_mutex_lock(pThis->mutTermOK); - pThis->bShallStop = 1; /* request termination */ - pthread_kill(pThis->thrdID, SIGUSR2); /* get thread out ouf blocking calls */ - pthread_join(pThis->thrdID, NULL); - pthread_mutex_unlock(pThis->mutTermOK); /* cleanup... */ - /* TODO: TIMEOUT! */ - } else if(pThis->eTermTool == eTermSync_NONE) { - pthread_cancel(pThis->thrdID); - pthread_join(pThis->thrdID, NULL); /* wait for cancel to complete */ - } +dbgprintf("Terminate thread %lx\n", pThis->thrdID); + pthread_cancel(pThis->thrdID); + pthread_join(pThis->thrdID, NULL); /* wait for cancel to complete */ pThis->bIsActive = 0; /* call cleanup function, if any */ @@ -164,7 +150,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(*afterRun)(thrdInfo_t *)) +rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), rsRetVal(*afterRun)(thrdInfo_t *)) { DEFiRet; thrdInfo_t *pThis; @@ -173,7 +159,6 @@ rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), eTermSyncType_t eTermSync assert(thrdMain != NULL); CHKiRet(thrdConstruct(&pThis)); - pThis->eTermTool = eTermSync_NONE; // eTermSyncType; TODO: review pThis->bIsActive = 1; pThis->pUsrThrdMain = thrdMain; pThis->pAfterRun = afterRun; |