summaryrefslogtreecommitdiffstats
path: root/runtime/wti.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-03-25 17:21:56 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-03-25 17:21:56 +0100
commit611b3364491cf30dc866932a053ae925e1f182ac (patch)
tree1318d02e01c72ce8e3e869e6b8977f45477ae100 /runtime/wti.c
parent7269efe60a2071e17f68f96b6416acaefeb7068d (diff)
parent6ffb9010811ee9bc0c3703716443c4dd00922f6f (diff)
downloadrsyslog-611b3364491cf30dc866932a053ae925e1f182ac.tar.gz
rsyslog-611b3364491cf30dc866932a053ae925e1f182ac.tar.xz
rsyslog-611b3364491cf30dc866932a053ae925e1f182ac.zip
Merge branch 'dapatch'
Diffstat (limited to 'runtime/wti.c')
-rw-r--r--runtime/wti.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/runtime/wti.c b/runtime/wti.c
index 9b3450e6..544bffa7 100644
--- a/runtime/wti.c
+++ b/runtime/wti.c
@@ -245,10 +245,14 @@ wtiJoinThrd(wti_t *pThis)
ISOBJ_TYPE_assert(pThis, wti);
dbgprintf("waiting for worker %s termination, current state %d\n", wtiGetDbgHdr(pThis), pThis->tCurrCmd);
- pthread_join(pThis->thrdID, NULL);
- wtiSetState(pThis, eWRKTHRD_STOPPED, 0, MUTEX_ALREADY_LOCKED); /* back to virgin... */
- pThis->thrdID = 0; /* invalidate the thread ID so that we do not accidently find reused ones */
+ if (pThis->thrdID == 0) {
+ dbgprintf("worker %s was already stopped\n", wtiGetDbgHdr(pThis));
+ } else {
+ pthread_join(pThis->thrdID, NULL);
+ wtiSetState(pThis, eWRKTHRD_STOPPED, 0, MUTEX_ALREADY_LOCKED); /* back to virgin... */
+ pThis->thrdID = 0; /* invalidate the thread ID so that we do not accidently find reused ones */
dbgprintf("worker %s has stopped\n", wtiGetDbgHdr(pThis));
+ }
RETiRet;
}