Re: Killing clones

Richard Gooch (rgooch@atnf.CSIRO.AU)
Sun, 10 Aug 1997 23:37:05 +1000


Ingo Molnar writes:
> On Sun, 10 Aug 1997, Richard Gooch wrote:
>
> > > > But how does this manager know when the parent has died? Does it
> > > > periodically wake up and check if its ppid == 1? Yuk.
> > >
> > > nope, use waitpid(-1,&status,..). The status then tells you why the child
> > > exited.
>
> > ??? But waitpid will not wait for the *parent* process, so how can it
> > use this to check for the existance of the parent?
>
> i mean it waits for processes in the same process group as well. Note that
> you are really going to reinvent LinuxThreads ... any reason why you have
> to use clone() directly?

>From the waitpid man page:

-1 which means to wait for any child process whose
process group ID is equal to the absolute value of
pid.

This seems to exclude the parent process.
I started using clone before LinuxThreads was really mature enough. I
don't need all the extra power of LinuxThreads, and it would require
work to change over to them and would also add a dependency on the
LinuxThreads library. I figure on biting the bullet when I move to
glibc.

Regards,

Richard....