summaryrefslogtreecommitdiffstats
path: root/runtime/wti.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-25 12:59:13 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-25 12:59:13 +0200
commit5af5b1e42868d00dfbc5fa47028768d0a03f8e32 (patch)
treeb967f080a0ae440cabda11d36475894e9fa43916 /runtime/wti.c
parentd12b9e0c67cc72c9b1631bf2a5611d383e7ad69d (diff)
downloadrsyslog-5af5b1e42868d00dfbc5fa47028768d0a03f8e32.tar.gz
rsyslog-5af5b1e42868d00dfbc5fa47028768d0a03f8e32.tar.xz
rsyslog-5af5b1e42868d00dfbc5fa47028768d0a03f8e32.zip
improvements/fixes in queue termination timeout handling
- bugfix: subtle (and usually irrelevant) issue in timout processing timeout could be one second too early if nanoseconds wrapped - set a more sensible timeout for shutdow, now 1.5 seconds to complete processing (this also removes those cases where the shutdown message was not written because the termination happened before it)
Diffstat (limited to 'runtime/wti.c')
-rw-r--r--runtime/wti.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/wti.c b/runtime/wti.c
index 9de7c365..156d8116 100644
--- a/runtime/wti.c
+++ b/runtime/wti.c
@@ -159,7 +159,7 @@ wtiSetState(wti_t *pThis, qWrkCmd_t tCmd, int bActiveOnly, int bLockMutex)
}
-/* Cancel the thread. If the thread is already cancelled or termination,
+/* Cancel the thread. If the thread is already cancelled or terminated,
* we do not again cancel it. But it is save and legal to call wtiCancelThrd() in
* such situations.
* rgerhards, 2008-02-26
@@ -173,8 +173,10 @@ wtiCancelThrd(wti_t *pThis)
d_pthread_mutex_lock(&pThis->mut);
+ wtiProcessThrdChanges(pThis, MUTEX_ALREADY_LOCKED); /* process state change, so that we have current state vars */
+
if(pThis->tCurrCmd >= eWRKTHRD_TERMINATING) {
- dbgoprint((obj_t*) pThis, "canceling worker thread\n");
+ dbgoprint((obj_t*) pThis, "canceling worker thread, curr stat %d\n", pThis->tCurrCmd);
pthread_cancel(pThis->thrdID);
wtiSetState(pThis, eWRKTHRD_TERMINATING, 0, MUTEX_ALREADY_LOCKED);
ATOMIC_STORE_1_TO_INT(pThis->pWtp->bThrdStateChanged); /* indicate change, so harverster will be called */