qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC] [PATCHv3 10/12] aio / timers: on timer modification,


From: Alex Bligh
Subject: [Qemu-devel] [RFC] [PATCHv3 10/12] aio / timers: on timer modification, qemu_notify or aio_notify
Date: Thu, 25 Jul 2013 23:16:46 +0100

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 <address@hidden>
---
 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

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