summaryrefslogtreecommitdiffstats
path: root/runtime/wti.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-20 12:53:00 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-20 12:53:00 +0200
commit1c580743390c704bcfb44148f4a70254c2c247da (patch)
tree885bfb41691bf7ee57d05d4ee0c0fa87742b156d /runtime/wti.c
parentbf8125f4e96a011ec28cc58b225bb815f72fc53c (diff)
downloadrsyslog-1c580743390c704bcfb44148f4a70254c2c247da.tar.gz
rsyslog-1c580743390c704bcfb44148f4a70254c2c247da.tar.xz
rsyslog-1c580743390c704bcfb44148f4a70254c2c247da.zip
solved potential race condition and some cleanup
code review brought up some few places where we may have run into a race. They have most probably been introduced during the recent set of changes. But I do not look at older versions because of the changed architecture, one can not simply backport this patch.
Diffstat (limited to 'runtime/wti.c')
-rw-r--r--runtime/wti.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/runtime/wti.c b/runtime/wti.c
index 900e1cba..c295ccc9 100644
--- a/runtime/wti.c
+++ b/runtime/wti.c
@@ -289,10 +289,12 @@ wtiWorker(wti_t *pThis)
}
/* indicate termination */
+ d_pthread_mutex_lock(pWtp->pmutUsr);
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave);
pthread_cleanup_pop(0); /* remove cleanup handler */
pWtp->pfOnWorkerShutdown(pWtp->pUsr);
pthread_setcancelstate(iCancelStateSave, NULL);
+ d_pthread_mutex_unlock(pWtp->pmutUsr);
RETiRet;
}