Commit 4260a739 authored by Paolo Bonzini's avatar Paolo Bonzini

qemu-timer: use atexit for quit_timers

Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent a5c57d64
......@@ -840,6 +840,13 @@ static void alarm_timer_on_change_state_rearm(void *opaque, int running,
qemu_rearm_alarm_timer((struct qemu_alarm_timer *) opaque);
}
static void quit_timers(void)
{
struct qemu_alarm_timer *t = alarm_timer;
alarm_timer = NULL;
t->stop(t);
}
int init_timer_alarm(void)
{
struct qemu_alarm_timer *t = NULL;
......@@ -859,6 +866,7 @@ int init_timer_alarm(void)
}
/* first event is at time 0 */
atexit(quit_timers);
t->pending = 1;
alarm_timer = t;
qemu_add_vm_change_state_handler(alarm_timer_on_change_state_rearm, t);
......@@ -869,13 +877,6 @@ fail:
return err;
}
void quit_timers(void)
{
struct qemu_alarm_timer *t = alarm_timer;
alarm_timer = NULL;
t->stop(t);
}
int qemu_calculate_timeout(void)
{
return 1000;
......
......@@ -62,7 +62,6 @@ void configure_alarms(char const *opt);
int qemu_calculate_timeout(void);
void init_clocks(void);
int init_timer_alarm(void);
void quit_timers(void);
int64_t cpu_get_ticks(void);
void cpu_enable_ticks(void);
......
......@@ -3565,7 +3565,6 @@ int main(int argc, char **argv, char **envp)
os_setup_post();
main_loop();
quit_timers();
net_cleanup();
res_free();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment