提交 4260a739 编写于 作者: P Paolo Bonzini

qemu-timer: use atexit for quit_timers

Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册