From: Michael Graff Date: Mon, 9 Sep 2002 20:04:10 +0000 (+0000) Subject: When scheduling a new timer, check to see if we missed our last wakeup X-Git-Tag: v9.2.3rc1~104^2~341 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=e5242f042b968e316bb775c0dea4eb230fc4f6a4;p=thirdparty%2Fbind9.git When scheduling a new timer, check to see if we missed our last wakeup by more than 15 seconds. If we have, SIGNAL(). --- diff --git a/lib/isc/timer.c b/lib/isc/timer.c index a80a65cdca6..1197f623f1e 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -15,12 +15,13 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: timer.c,v 1.69 2002/09/09 06:01:06 marka Exp $ */ +/* $Id: timer.c,v 1.70 2002/09/09 20:04:10 explorer Exp $ */ #include #include #include +#include #include #include #include @@ -183,6 +184,31 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) { * run thread, or explicitly setting the value in the manager. */ #ifdef ISC_PLATFORM_USETHREADS + + /* + * This is a temporary (probably) hack to fix a bug on tru64 5.1 + * and 5.1a. Sometimes, pthread_cond_timedwait() doesn't actually + * return when the time expires, so here, we check to see if + * we're 15 seconds or more behind, and if we are, we signal + * the dispatcher. This isn't such a bad idea as a general purpose + * watchdog, so perhaps we should just leave it in here. + */ + if (signal_ok) { + isc_interval_t fifteen; + isc_time_t then; + + isc_interval_set(&fifteen, 15, 0); + isc_time_add(&manager->due, &fifteen, &then); + + if (isc_time_compare(&then, now) < 0) { + SIGNAL(&manager->wakeup); + signal_ok = ISC_FALSE; + isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_TIMER, ISC_LOG_WARNING, + "*** POKED TIMER ***"); + } + } + if (timer->index == 1 && signal_ok) { XTRACE(isc_msgcat_get(isc_msgcat, ISC_MSGSET_TIMER, ISC_MSG_SIGNALSCHED, @@ -659,12 +685,11 @@ run(void *uap) { if (manager->nscheduled > 0) { XTRACETIME2(isc_msgcat_get(isc_msgcat, - ISC_MSGSET_GENERAL, - ISC_MSG_WAITUNTIL, - "waituntil"), - manager->due, now); - result = WAITUNTIL(&manager->wakeup, &manager->lock, - &manager->due); + ISC_MSGSET_GENERAL, + ISC_MSG_WAITUNTIL, + "waituntil"), + manager->due, now); + result = WAITUNTIL(&manager->wakeup, &manager->lock, &manager->due); INSIST(result == ISC_R_SUCCESS || result == ISC_R_TIMEDOUT); } else {