From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6xMh-0006gZ-AW for qemu-devel@nongnu.org; Wed, 07 Aug 2013 02:37:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6xMb-0002dG-5u for qemu-devel@nongnu.org; Wed, 07 Aug 2013 02:36:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43459) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6xMa-0002cw-Us for qemu-devel@nongnu.org; Wed, 07 Aug 2013 02:36:53 -0400 Message-ID: <5201EB97.9090207@redhat.com> Date: Wed, 07 Aug 2013 08:39:19 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <1375831766-3444-1-git-send-email-akong@redhat.com> In-Reply-To: <1375831766-3444-1-git-send-email-akong@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Moving alarm_timer assignment before atexit() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong Cc: vyasevic@redhat.com, pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org 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 > --- > 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: >