From 3d26cfc1854cdae96b62b536983b1239b32e9ec2 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 25 Jan 2008 19:57:42 +0000 Subject: fixed worker timeout which was accidently not set (and thus 0) --- queue.c | 2 ++ srUtils.c | 6 +++++- wti.c | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/queue.c b/queue.c index 421fd651..9cfb6c3b 100644 --- a/queue.c +++ b/queue.c @@ -307,6 +307,7 @@ queueInitDA(queue_t *pThis, int bEnqOnly, int bLockMutex) CHKiRet(wtpSetpmutUsr (pThis->pWtpDA, pThis->mut)); CHKiRet(wtpSetpcondBusy (pThis->pWtpDA, &pThis->notEmpty)); CHKiRet(wtpSetiNumWorkerThreads (pThis->pWtpDA, 1)); + CHKiRet(wtpSettoWrkShutdown (pThis->pWtpDA, pThis->toWrkShutdown)); CHKiRet(wtpSetpUsr (pThis->pWtpDA, pThis)); CHKiRet(wtpConstructFinalize (pThis->pWtpDA)); } @@ -1324,6 +1325,7 @@ dbgprintf("Queue %p: post mutexes, mut %p\n", pThis, pThis->mut); CHKiRet(wtpSetpmutUsr (pThis->pWtpReg, pThis->mut)); CHKiRet(wtpSetpcondBusy (pThis->pWtpReg, &pThis->notEmpty)); CHKiRet(wtpSetiNumWorkerThreads (pThis->pWtpReg, pThis->iNumWorkerThreads)); + CHKiRet(wtpSettoWrkShutdown (pThis->pWtpReg, pThis->toWrkShutdown)); CHKiRet(wtpSetpUsr (pThis->pWtpReg, pThis)); CHKiRet(wtpConstructFinalize (pThis->pWtpReg)); diff --git a/srUtils.c b/srUtils.c index efcd7e6d..3d30f5a2 100755 --- a/srUtils.c +++ b/srUtils.c @@ -321,12 +321,16 @@ timeoutComp(struct timespec *pt, long iTimeout) assert(pt != NULL); /* compute timeout */ clock_gettime(CLOCK_REALTIME, pt); +RUNLOG_VAR("%ld", pt->tv_nsec); pt->tv_nsec += (iTimeout % 1000) * 1000000; /* think INTEGER arithmetic! */ +RUNLOG_VAR("%ld", pt->tv_nsec); if(pt->tv_nsec > 999999999) { /* overrun? */ +RUNLOG; pt->tv_nsec -= 1000000000; - ++pt->tv_sec; } +RUNLOG_VAR("%ld", pt->tv_sec); pt->tv_sec += iTimeout / 1000; +RUNLOG_VAR("%ld", pt->tv_sec); return RS_RET_OK; /* so far, this is static... */ } diff --git a/wti.c b/wti.c index 3f60afb2..23ad2415 100644 --- a/wti.c +++ b/wti.c @@ -419,6 +419,7 @@ dbgprintf("%s: start worker run, queue cmd currently %d\n", wtiGetDbgHdr(pThis), d_pthread_cond_wait(pWtp->pcondBusy, pWtp->pmutUsr); } else { timeoutComp(&t, pWtp->toWrkShutdown);/* get absolute timeout */ +dbgprintf("timeout value is %ld\n", timeoutVal(&t)); if(d_pthread_cond_timedwait(pWtp->pcondBusy, pWtp->pmutUsr, &t) != 0) { dbgprintf("%s: inactivity timeout, worker terminating...\n", wtiGetDbgHdr(pThis)); bInactivityTOOccured = 1; /* indicate we had a timeout */ -- cgit