summaryrefslogtreecommitdiffstats
path: root/runtime/wti.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-03-26 17:51:17 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-03-26 17:51:17 +0100
commit4989036e70a8538568d672602c96d828970df033 (patch)
treeaab0d1d05452efb2034f09878b2eef5e1bc8706e /runtime/wti.c
parent0be199af6cc2cd9a9acb96e97e1cd061affaa6d9 (diff)
parent611b3364491cf30dc866932a053ae925e1f182ac (diff)
downloadrsyslog-4989036e70a8538568d672602c96d828970df033.tar.gz
rsyslog-4989036e70a8538568d672602c96d828970df033.tar.bz2
rsyslog-4989036e70a8538568d672602c96d828970df033.zip
Merge branch 'master' into tests
Conflicts: ChangeLog
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;
}