qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Moving alarm_timer assignment before atexit()
@ 2013-08-06 23:29 Amos Kong
  2013-08-07  6:39 ` Laszlo Ersek
  0 siblings, 1 reply; 5+ messages in thread
From: Amos Kong @ 2013-08-06 23:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: vyasevic, pbonzini, aliguori, lersek

We register exit clean function by atexit(),
but alarm_timer is NULL here. If exit is caused
between atexit() and alarm_timer assignment,
real timer can't be cleaned. So move alarm_timer
assignment before atexit().

Signed-off-by: Amos Kong <akong@redhat.com>
---
 qemu-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-timer.c b/qemu-timer.c
index b2d95e2..9490105 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -767,11 +767,11 @@ int init_timer_alarm(void)
         goto fail;
     }
 
+    alarm_timer = t;
     atexit(quit_timers);
 #ifdef CONFIG_POSIX
     pthread_atfork(NULL, NULL, reinit_timers);
 #endif
-    alarm_timer = t;
     return 0;
 
 fail:
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-08  8:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-06 23:29 [Qemu-devel] [PATCH] Moving alarm_timer assignment before atexit() Amos Kong
2013-08-07  6:39 ` Laszlo Ersek
2013-08-07  7:57   ` Stefan Hajnoczi
2013-08-07  8:17     ` Amos Kong
2013-08-08  8:19       ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).