Skip to content
Snippets Groups Projects
Commit 744ca8e3 authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

qemu-timer: make initialization functions idempotent


Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent dbb5f380
No related branches found
No related tags found
No related merge requests found
......@@ -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];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment