Fix event insertion when processing more than one event for the current time.
authorAndrew Cagney <cagney@redhat.com>
Fri, 28 Apr 2000 06:02:51 +0000 (06:02 +0000)
committerAndrew Cagney <cagney@redhat.com>
Fri, 28 Apr 2000 06:02:51 +0000 (06:02 +0000)
sim/ppc/ChangeLog
sim/ppc/events.c

index 36bb6564291bdef37deddbdc24733e8601da903a..e1822340a059be43bcf1017f5f993cfed86efd33 100644 (file)
@@ -1,3 +1,10 @@
+Fri Apr 28 15:59:27 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * events.c (event_queue_process): Call update_time_from_event
+       every time an event is removed from the queue.
+       (update_time_from_event): Delete assertion that a negative
+       time_from_event implies an empty event queue.
+
 Fri Apr 28 15:53:54 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
        * interrupts.c (deliver_hardware_interrupt): Print time trace in
index 5743ffd799ec4dc8fb514071beae73b91372cc97..72c91386bea9d17cb5cfcd5a633040a77fff8b0b 100644 (file)
@@ -180,7 +180,6 @@ update_time_from_event(event_queue *events)
        }
     }
   ASSERT(current_time == event_queue_time(events));
-  ASSERT((events->time_from_event >= 0) == (events->queue != NULL));
 }
 
 STATIC_INLINE_EVENTS\
@@ -394,12 +393,15 @@ event_queue_process(event_queue *events)
                         (long)handler,
                         (long)data));
     zfree(to_do);
+    /* Always re-compute the time to the next event so that HANDLER()
+       can safely insert new events into the queue. */
+    update_time_from_event(events);
     handler(data);
   }
   events->processing = 0;
 
-  /* re-caculate time for new events */
-  update_time_from_event(events);
+  ASSERT(events->time_from_event > 0);
+  ASSERT(events->queue != NULL); /* always poll event */
 }