summaryrefslogtreecommitdiffstats
path: root/runtime/wti.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-04-02 13:04:09 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-04-02 13:04:09 +0200
commit589f8af56cac4a4b55de757834b6e632a199e395 (patch)
tree8886083e0f9e8059bbbc5184a7d1133c1cfdbd60 /runtime/wti.c
parent16b960939ee44155a9ac6ac6999b6ab71f237034 (diff)
parent6ffb9010811ee9bc0c3703716443c4dd00922f6f (diff)
downloadrsyslog-589f8af56cac4a4b55de757834b6e632a199e395.tar.gz
rsyslog-589f8af56cac4a4b55de757834b6e632a199e395.tar.bz2
rsyslog-589f8af56cac4a4b55de757834b6e632a199e395.zip
Merge branch 'dapatch' into v3-stable
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 13554232..a2531499 100644
--- a/runtime/wti.c
+++ b/runtime/wti.c
@@ -238,10 +238,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;
}