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

On 08/07/13 01:29, Amos Kong wrote:
> 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.

That's correct in general, but I don't see how it could happen in the
code being patched. pthread_atfork() won't call exit().

Thanks,
Laszlo

> 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:
> 

  reply	other threads:[~2013-08-07  6:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 23:29 [Qemu-devel] [PATCH] Moving alarm_timer assignment before atexit() Amos Kong
2013-08-07  6:39 ` Laszlo Ersek [this message]
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=5201EB97.9090207@redhat.com \
    --to=lersek@redhat.com \
    --cc=akong@redhat.com \
    --cc=aliguori@us.ibm.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.