From ef70e6174d4b373a601b73757ca19bb0f7dd6502 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 20 Jul 2009 10:25:02 +0200 Subject: 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. --- runtime/wti.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'runtime/wti.c') diff --git a/runtime/wti.c b/runtime/wti.c index b55ff69c..1d8f075f 100644 --- a/runtime/wti.c +++ b/runtime/wti.c @@ -86,6 +86,17 @@ wtiGetState(wti_t *pThis) } +/* Set this thread to "always running" state (can not be unset) + * rgerhards, 2009-07-20 + */ +rsRetVal +wtiSetAlwaysRunning(wti_t *pThis) +{ + ISOBJ_TYPE_assert(pThis, wti); + pThis->bAlwaysRunning = TRUE; + return RS_RET_OK; +} + /* Set status (thread is running or not), actually an property of * use for wtp, but we need to have it per thread instance (thus it * is inside wti). -- rgerhards, 2009-07-17 @@ -202,7 +213,8 @@ doIdleProcessing(wti_t *pThis, wtp_t *pWtp, int *pbInactivityTOOccured) pWtp->pfOnIdle(pWtp->pUsr, MUTEX_ALREADY_LOCKED); d_pthread_mutex_lock(pWtp->pmutUsr); - if(pWtp->toWrkShutdown == -1) { +RUNLOG_VAR("%d", pThis->bAlwaysRunning); + if(pThis->bAlwaysRunning) { /* never shut down any started worker */ d_pthread_cond_wait(pWtp->pcondBusy, pWtp->pmutUsr); } else { -- cgit