summaryrefslogtreecommitdiffstats
path: root/threads.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-02-11 17:47:30 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-02-11 17:47:30 +0100
commitf3d354da3e373f9c4890a78e5274a6ba02f1c8cb (patch)
tree9fd7c964af36dfa1802bf08173fefca2a9453a4e /threads.c
parent6a18d25cbec2676a7910ff038170716293abe89f (diff)
downloadrsyslog-f3d354da3e373f9c4890a78e5274a6ba02f1c8cb.tar.gz
rsyslog-f3d354da3e373f9c4890a78e5274a6ba02f1c8cb.tar.xz
rsyslog-f3d354da3e373f9c4890a78e5274a6ba02f1c8cb.zip
bugfix: very long running actions could prevent shutdown under some circumstances
This has now been solved, at least for common situations.
Diffstat (limited to 'threads.c')
-rw-r--r--threads.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/threads.c b/threads.c
index d4e14527..fcafce4b 100644
--- a/threads.c
+++ b/threads.c
@@ -101,12 +101,14 @@ thrdTerminateNonCancel(thrdInfo_t *pThis)
do {
d_pthread_mutex_lock(&pThis->mutThrd);
pthread_kill(pThis->thrdID, SIGTTIN);
- timeoutComp(&tTimeout, 10); /* a fixed 10ms timeout, do after lock (may take long!) */
+ timeoutComp(&tTimeout, 1000); /* a fixed 1sec timeout */
ret = d_pthread_cond_timedwait(&pThis->condThrdTerm, &pThis->mutThrd, &tTimeout);
d_pthread_mutex_unlock(&pThis->mutThrd);
if(Debug) {
if(ret == ETIMEDOUT) {
- dbgprintf("input thread term: had a timeout waiting on thread termination\n");
+ dbgprintf("input thread term: timeout expired waiting on thread termination - canceling\n");
+ pthread_cancel(pThis->thrdID);
+ pThis->bIsActive = 0;
} else if(ret == 0) {
dbgprintf("input thread term: thread returned normally and is terminated\n");
} else {