aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2010-03-10 11:38:44 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-03-17 11:14:53 -0500
commit3a720b14b9e09f8553832b835ede9933b70fe9a9 (patch)
tree0f6b2bd2e18a92192e161c69133c467d72a3662a /vl.c
parent1db89e912365ff36ef436732ed81e4a1bb43056e (diff)
remove qemu_rearm_alarm_timer from main loop
Make the timer subsystem register its own callback instead. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index 0b75cfda75..788b334408 100644
--- a/vl.c
+++ b/vl.c
@@ -1417,6 +1417,12 @@ static void win32_rearm_timer(struct qemu_alarm_timer *t)
#endif /* _WIN32 */
+static void alarm_timer_on_change_state_rearm(void *opaque, int running, int reason)
+{
+ if (running)
+ qemu_rearm_alarm_timer((struct qemu_alarm_timer *) opaque);
+}
+
static int init_timer_alarm(void)
{
struct qemu_alarm_timer *t = NULL;
@@ -1438,6 +1444,7 @@ static int init_timer_alarm(void)
/* first event is at time 0 */
t->pending = 1;
alarm_timer = t;
+ qemu_add_vm_change_state_handler(alarm_timer_on_change_state_rearm, t);
return 0;
@@ -3080,7 +3087,6 @@ void vm_start(void)
cpu_enable_ticks();
vm_running = 1;
vm_state_notify(1, 0);
- qemu_rearm_alarm_timer(alarm_timer);
resume_all_vcpus();
}
}