summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-09-19 10:18:51 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2011-10-21 18:14:30 +0200
commit4260a7391190d2d01fac50ee3d738a15bab6b98e (patch)
tree49af59eb9046c9f8b18f6ca719f789d9c6db40bf
parenta5c57d64aa61b700db444c4864a1da11f1165db6 (diff)
downloadqemu-4260a7391190d2d01fac50ee3d738a15bab6b98e.zip
qemu-timer: use atexit for quit_timers
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--qemu-timer.c15
-rw-r--r--qemu-timer.h1
-rw-r--r--vl.c1
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);
diff --git a/vl.c b/vl.c
index 66f70fb6ae..6bd7e7158a 100644
--- a/vl.c
+++ b/vl.c
@@ -3565,7 +3565,6 @@ int main(int argc, char **argv, char **envp)
os_setup_post();
main_loop();
- quit_timers();
net_cleanup();
res_free();