summaryrefslogtreecommitdiffstats
path: root/runtime/wti.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-04-02 14:49:04 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-04-02 14:49:04 +0200
commitc250c50633d615ad261d8b3ff0e491f1032de5f6 (patch)
treee684746f76c4ba8086a2b7efee81c18c9e1dad16 /runtime/wti.c
parentae7a01e137f14055f9472408d0cf3ebf9893afba (diff)
parent01adeab0cba21ad6193addf1a4e90689b507d092 (diff)
downloadrsyslog-c250c50633d615ad261d8b3ff0e491f1032de5f6.tar.gz
rsyslog-c250c50633d615ad261d8b3ff0e491f1032de5f6.tar.bz2
rsyslog-c250c50633d615ad261d8b3ff0e491f1032de5f6.zip
Merge branch 'v3-stable' into beta
Conflicts: ChangeLog configure.ac doc/manual.html
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 365b25d5..343a7227 100644
--- a/runtime/wti.c
+++ b/runtime/wti.c
@@ -237,10 +237,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;
}