All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: qemu-devel@nongnu.org
Cc: vyasevic@redhat.com, pbonzini@redhat.com, aliguori@us.ibm.com,
	lersek@redhat.com
Subject: [Qemu-devel] [PATCH] Moving alarm_timer assignment before atexit()
Date: Wed,  7 Aug 2013 07:29:26 +0800	[thread overview]
Message-ID: <1375831766-3444-1-git-send-email-akong@redhat.com> (raw)

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

             reply	other threads:[~2013-08-06 23:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 23:29 Amos Kong [this message]
2013-08-07  6:39 ` [Qemu-devel] [PATCH] Moving alarm_timer assignment before atexit() Laszlo Ersek
2013-08-07  7:57   ` Stefan Hajnoczi
2013-08-07  8:17     ` Amos Kong
2013-08-08  8:19       ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375831766-3444-1-git-send-email-akong@redhat.com \
    --to=akong@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=lersek@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vyasevic@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.