qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC] [PATCHv6 13/16] aio / timers: On timer modification,


From: Alex Bligh
Subject: [Qemu-devel] [RFC] [PATCHv6 13/16] aio / timers: On timer modification, qemu_notify or aio_notify
Date: Tue, 6 Aug 2013 10:16:29 +0100

On qemu_mod_timer_ns, ensure qemu_notify or aio_notify is called to
end the appropriate poll(), irrespective of use_icount value.

On qemu_clock_enable, ensure qemu_notify or aio_notify is called for
all QEMUTimerLists attached to the QEMUClock.

Signed-off-by: Alex Bligh <address@hidden>
---
 include/qemu/timer.h |    1 +
 qemu-timer.c         |   13 ++++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index d23173c..d3d4701 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -62,6 +62,7 @@ int64_t qemu_clock_deadline(QEMUClock *clock);
 int64_t qemu_clock_deadline_ns(QEMUClock *clock);
 bool qemu_clock_use_for_deadline(QEMUClock *clock);
 QEMUTimerList *qemu_clock_get_default_timerlist(QEMUClock *clock);
+void qemu_clock_notify(QEMUClock *clock);
 
 QEMUTimerList *timerlist_new(QEMUClockType type);
 void timerlist_free(QEMUTimerList *tl);
diff --git a/qemu-timer.c b/qemu-timer.c
index dd5ed3f..5f65455 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -304,11 +304,20 @@ bool qemu_clock_use_for_deadline(QEMUClock *clock)
     return !(use_icount && (clock->type = QEMU_CLOCK_VIRTUAL));
 }
 
+void qemu_clock_notify(QEMUClock *clock)
+{
+    QEMUTimerList *tl;
+    QLIST_FOREACH(tl, &clock->timerlists, list) {
+        timerlist_notify(tl);
+    }
+}
+
 void qemu_clock_enable(QEMUClock *clock, bool enabled)
 {
     bool old = clock->enabled;
     clock->enabled = enabled;
     if (enabled && !old) {
+        qemu_clock_notify(clock);
         qemu_rearm_alarm_timer(alarm_timer);
     }
 }
@@ -529,9 +538,7 @@ void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time)
         }
         /* Interrupt execution to force deadline recalculation.  */
         qemu_clock_warp(ts->tl->clock);
-        if (use_icount) {
-            timerlist_notify(ts->tl);
-        }
+        timerlist_notify(ts->tl);
     }
 }
 
-- 
1.7.9.5




reply via email to

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