]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
When scheduling a new timer, check to see if we missed our last wakeup
authorMichael Graff <mgraff@isc.org>
Mon, 9 Sep 2002 20:04:10 +0000 (20:04 +0000)
committerMichael Graff <mgraff@isc.org>
Mon, 9 Sep 2002 20:04:10 +0000 (20:04 +0000)
by more than 15 seconds.  If we have, SIGNAL().

lib/isc/timer.c

index a80a65cdca6494f142a679d42d82f4312b666c3a..1197f623f1ed679da77658a3777d2c9e13cf8048 100644 (file)
  * 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 <config.h>
 
 #include <isc/condition.h>
 #include <isc/heap.h>
+#include <isc/log.h>
 #include <isc/magic.h>
 #include <isc/mem.h>
 #include <isc/msgs.h>
@@ -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 {