aboutsummaryrefslogtreecommitdiff
path: root/qemu-timer.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-10-29 15:26:28 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2012-10-30 09:18:44 +0100
commit744ca8e3754e6808c6b5331d287adc533fca0ad3 (patch)
tree6265422a2554a3eddc3bfd8ea8978d4a349e4977 /qemu-timer.c
parentdbb5f3802e20af9a9971aa98d27c58839ea79a94 (diff)
downloadqemu-744ca8e3754e6808c6b5331d287adc533fca0ad3.zip
qemu-744ca8e3754e6808c6b5331d287adc533fca0ad3.tar.gz
qemu-744ca8e3754e6808c6b5331d287adc533fca0ad3.tar.bz2
qemu-timer: make initialization functions idempotent
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qemu-timer.c')
-rw-r--r--qemu-timer.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/qemu-timer.c b/qemu-timer.c
index 908a103..b71e9a6 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -430,9 +430,11 @@ void qemu_unregister_clock_reset_notifier(QEMUClock *clock, Notifier *notifier)
void init_clocks(void)
{
- rt_clock = qemu_new_clock(QEMU_CLOCK_REALTIME);
- vm_clock = qemu_new_clock(QEMU_CLOCK_VIRTUAL);
- host_clock = qemu_new_clock(QEMU_CLOCK_HOST);
+ if (!rt_clock) {
+ rt_clock = qemu_new_clock(QEMU_CLOCK_REALTIME);
+ vm_clock = qemu_new_clock(QEMU_CLOCK_VIRTUAL);
+ host_clock = qemu_new_clock(QEMU_CLOCK_HOST);
+ }
}
uint64_t qemu_timer_expire_time_ns(QEMUTimer *ts)
@@ -745,6 +747,10 @@ int init_timer_alarm(void)
struct qemu_alarm_timer *t = NULL;
int i, err = -1;
+ if (alarm_timer) {
+ return 0;
+ }
+
for (i = 0; alarm_timers[i].name; i++) {
t = &alarm_timers[i];