diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-07-20 10:25:02 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-07-20 10:25:02 +0200 |
commit | ef70e6174d4b373a601b73757ca19bb0f7dd6502 (patch) | |
tree | 50bc958008b9cd4c7faf838e8911acc0e4c089b5 /runtime/wtp.c | |
parent | b3978e7f7381c694a30a83c67c3fe2e1acc54207 (diff) | |
download | rsyslog-ef70e6174d4b373a601b73757ca19bb0f7dd6502.tar.gz rsyslog-ef70e6174d4b373a601b73757ca19bb0f7dd6502.tar.xz rsyslog-ef70e6174d4b373a601b73757ca19bb0f7dd6502.zip |
architecture change: queue now always has at least one worker thread
...if not running in direct mode. Previous versions could run without
any active workers. This simplifies the code at a very small expense.
See v5 compatibility note document for more in-depth discussion.
Diffstat (limited to 'runtime/wtp.c')
-rw-r--r-- | runtime/wtp.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/wtp.c b/runtime/wtp.c index e1ebcd4c..e8bc5120 100644 --- a/runtime/wtp.c +++ b/runtime/wtp.c @@ -381,7 +381,9 @@ wtpStartWrkr(wtp_t *pThis, int bLockMutex) if(i == pThis->iNumWorkerThreads) ABORT_FINALIZE(RS_RET_NO_MORE_THREADS); - pThis->iCurNumWrkThrd++; /* we got one more! */ + if(i == 0 || pThis->toWrkShutdown == -1) { + wtiSetAlwaysRunning(pThis->pWrkr[i]); + } pWti = pThis->pWrkr[i]; wtiSetState(pWti, WRKTHRD_RUNNING); @@ -389,6 +391,8 @@ wtpStartWrkr(wtp_t *pThis, int bLockMutex) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); iState = pthread_create(&(pWti->thrdID), &attr, wtpWorker, (void*) pWti); pthread_attr_destroy(&attr); /* TODO: we could globally reuse such an attribute 2009-07-08 */ + pThis->iCurNumWrkThrd++; /* we got one more! */ + dbgprintf("%s: started with state %d, num workers now %d\n", wtpGetDbgHdr(pThis), iState, pThis->iCurNumWrkThrd); |