monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] auto updates


From: Nathaniel Smith
Subject: Re: [Monotone-devel] auto updates
Date: Sun, 29 Oct 2006 16:58:59 -0800
User-agent: Mutt/1.5.13 (2006-08-11)

On Sun, Oct 29, 2006 at 09:13:15AM +0000, Nuno Lucas wrote:
> On 10/29/06, Zack Weinberg <address@hidden> wrote:
> >On 10/29/06, Nathaniel Smith <address@hidden> wrote:
> >>
> >> It should be possible to deal with zombies through some POSIX hackery,
> >> no?  The only tricky bit is that we _do_ sometimes want to wait for a
> >> process, so we can't just unconditionally get rid of zombies...
> >
> >Fork a child, which forks a grandchild and exits.  Grandchild execs
> >what you really wanted to run.  wait() returns for the child, and the
> >grandchild gets reparented to init.
> 
> This seems a bit of a hack when a simple solution is easy.
> 
> Just do this for POSIX systems (I don't believe there is a problem
> with zombie processes on other systems):
> 
> static void signal_handler( int sig, siginfo_t* si, void * context )
> {
>   int status;
>   wait (&status);
> }

FYI, this is a bit buggy -- it can leave zombies if signals get
coalesced, or freeze if other processes might call wait() before the
signal handler runs.

But this technique is what I meant by "unconditionally get rid of
zombies" -- I'm not sure what happens when you have a signal handler
like this, _and_ you sometimes want to call waitpid() in your program
explicitly.

-- Nathaniel

-- 
- Don't let your informants burn anything.
- Don't grow old.
- Be good grad students.
  -- advice of Murray B. Emeneau on the occasion of his 100th birthday




reply via email to

[Prev in Thread] Current Thread [Next in Thread]