aboutsummaryrefslogtreecommitdiff
path: root/qemu-timer.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-09-27 18:23:14 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2011-10-21 18:14:30 +0200
commitfbdc14ebf8d16f00a87b6f4cdb4799ccfb6469be (patch)
tree173e9974b19ba7621f56260b6f7d82d1e06d6d94 /qemu-timer.c
parent2ff68d0738768643e796ab39f007c1f3858e67f1 (diff)
qemu-timer: do not use RunState change handlers
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qemu-timer.c')
-rw-r--r--qemu-timer.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/qemu-timer.c b/qemu-timer.c
index 58926dd617..f11a28dd03 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -273,7 +273,11 @@ static QEMUClock *qemu_new_clock(int type)
void qemu_clock_enable(QEMUClock *clock, int enabled)
{
+ bool old = clock->enabled;
clock->enabled = enabled;
+ if (enabled && !old) {
+ qemu_rearm_alarm_timer(alarm_timer);
+ }
}
int64_t qemu_clock_has_timers(QEMUClock *clock)
@@ -806,13 +810,6 @@ static void win32_rearm_timer(struct qemu_alarm_timer *t,
#endif /* _WIN32 */
-static void alarm_timer_on_change_state_rearm(void *opaque, int running,
- RunState state)
-{
- if (running)
- qemu_rearm_alarm_timer((struct qemu_alarm_timer *) opaque);
-}
-
static void quit_timers(void)
{
struct qemu_alarm_timer *t = alarm_timer;
@@ -842,7 +839,6 @@ int init_timer_alarm(void)
atexit(quit_timers);
t->pending = 1;
alarm_timer = t;
- qemu_add_vm_change_state_handler(alarm_timer_on_change_state_rearm, t);
return 0;