On qemu_clock_enable or qemu_mod_timer_ns, ensure qemu_notify
or aio_notify is called to end the appropriate poll().

Signed-off-by: Alex Bligh <a...@alex.org.uk>
---
 qemu-timer.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/qemu-timer.c b/qemu-timer.c
index 6efd1b4..a0cbeaa 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -264,11 +264,21 @@ void qemu_clock_set_ctx(QEMUClock *clock, AioContext * 
ctx)
     clock->ctx = ctx;
 }
 
+static void qemu_clock_notify(QEMUClock *clock)
+{
+    if (clock->ctx) {
+        aio_notify(clock->ctx);
+    } else {
+        qemu_notify_event();
+    }
+}
+
 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);
     }
 }
@@ -436,9 +446,7 @@ void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time)
         }
         /* Interrupt execution to force deadline recalculation.  */
         qemu_clock_warp(ts->clock);
-        if (use_icount) {
-            qemu_notify_event();
-        }
+        qemu_clock_notify(ts->clock);
     }
 }
 
-- 
1.7.9.5


Reply via email to