[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 12/18] qemu-timer: fix off-by-one

From: Paolo Bonzini
Subject: [Qemu-devel] [PULL 12/18] qemu-timer: fix off-by-one
Date: Tue, 14 Mar 2017 17:18:14 +0100

If the first timer is exactly at the current value of the clock, the
deadline is met and the timer should fire.  This fixes itself on the next
iteration of the loop without icount; with icount, however, execution
of instructions will stop exactly at the deadline and won't proceed.

Reviewed-by: Alex Bennée <address@hidden>
Reviewed-by: Edgar E. Iglesias <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
 util/qemu-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/qemu-timer.c b/util/qemu-timer.c
index 6cf70b9..2f20151 100644
--- a/util/qemu-timer.c
+++ b/util/qemu-timer.c
@@ -199,7 +199,7 @@ bool timerlist_expired(QEMUTimerList *timer_list)
     expire_time = timer_list->active_timers->expire_time;
-    return expire_time < qemu_clock_get_ns(timer_list->clock->type);
+    return expire_time <= qemu_clock_get_ns(timer_list->clock->type);
 bool qemu_clock_expired(QEMUClockType type)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]