]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Rework previous slightly, to only signal if we were using WAITUNTIL() and we
authorMichael Graff <mgraff@isc.org>
Mon, 9 Sep 2002 21:15:58 +0000 (21:15 +0000)
committerMichael Graff <mgraff@isc.org>
Mon, 9 Sep 2002 21:15:58 +0000 (21:15 +0000)
actually have a due time

lib/isc/timer.c

index 1197f623f1ed679da77658a3777d2c9e13cf8048..a21204066c8c5914a76e409b452a3356b48fed3b 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: timer.c,v 1.70 2002/09/09 20:04:10 explorer Exp $ */
+/* $Id: timer.c,v 1.71 2002/09/09 21:15:58 explorer Exp $ */
 
 #include <config.h>
 
@@ -111,6 +111,9 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
        isc_timermgr_t *manager;
        isc_time_t due;
        int cmp;
+#ifdef ISC_PLATFORM_USETHREADS
+       isc_boolean_t timedwait;
+#endif
 
        /*
         * Note: the caller must ensure locking.
@@ -122,6 +125,16 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
        UNUSED(signal_ok);
 #endif /* ISC_PLATFORM_USETHREADS */
 
+       manager = timer->manager;
+
+#ifdef ISC_PLATFORM_USETHREADS
+       /*
+        * If the manager was timed wait, we may need to signal the
+        * manager to force a wakeup.
+        */
+       timedwait = ISC_TF(manager->nscheduled > 0 && manager->due.seconds != 0);
+#endif
+
        /*
         * Compute the new due time.
         */
@@ -146,7 +159,7 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
        /*
         * Schedule the timer.
         */
-       manager = timer->manager;
+
        if (timer->index > 0) {
                /*
                 * Already scheduled.
@@ -193,7 +206,7 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
         * 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) {
+       if (signal_ok && timedwait) {
                isc_interval_t fifteen;
                isc_time_t then;