summaryrefslogtreecommitdiffstats
path: root/threads.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-02-18 10:51:14 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-02-18 10:51:14 +0100
commit9568e7dbbb50ceb7464b659283e97a63ba3b1bd6 (patch)
treec5f10c015dae3fcfcf52e2bc5985d40cb70fa119 /threads.c
parentb941f68aaeec4bd458328e09121b623ac63f6dd6 (diff)
parent9f1e195f3d642de85a92199ef9882b820d3fec21 (diff)
downloadrsyslog-9568e7dbbb50ceb7464b659283e97a63ba3b1bd6.tar.gz
rsyslog-9568e7dbbb50ceb7464b659283e97a63ba3b1bd6.tar.bz2
rsyslog-9568e7dbbb50ceb7464b659283e97a63ba3b1bd6.zip
Merge branch 'v5-beta'
Conflicts: ChangeLog configure.ac doc/manual.html runtime/glbl.c tools/omdiscard.c
Diffstat (limited to 'threads.c')
-rw-r--r--threads.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/threads.c b/threads.c
index d4e14527..11c9a1d8 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 {
@@ -194,8 +196,8 @@ static void* thrdStarter(void *arg)
* keep the thread debugger happer, it would not really be necessary with
* the logic we employ...)
*/
- pThis->bIsActive = 0;
d_pthread_mutex_lock(&pThis->mutThrd);
+ pThis->bIsActive = 0;
pthread_cond_signal(&pThis->condThrdTerm);
d_pthread_mutex_unlock(&pThis->mutThrd);