diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2011-09-19 10:18:51 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2011-10-21 18:14:30 +0200 |
commit | 4260a7391190d2d01fac50ee3d738a15bab6b98e (patch) | |
tree | 49af59eb9046c9f8b18f6ca719f789d9c6db40bf | |
parent | a5c57d64aa61b700db444c4864a1da11f1165db6 (diff) |
qemu-timer: use atexit for quit_timers
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | qemu-timer.c | 15 | ||||
-rw-r--r-- | qemu-timer.h | 1 | ||||
-rw-r--r-- | vl.c | 1 |
3 files changed, 8 insertions, 9 deletions
diff --git a/qemu-timer.c b/qemu-timer.c index d8507e3e0f..7fa81e1d01 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -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; diff --git a/qemu-timer.h b/qemu-timer.h index ce576b90a4..b4ea2015ea 100644 --- a/qemu-timer.h +++ b/qemu-timer.h @@ -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(); |