On Wed, 14 Aug 2002, Bob Showalter wrote:

> > > >>
> > > >>                    use POSIX ":sys_wait_h";
> > > >>                    #...
> > > >>                    do {
> > > >>                        $kid = waitpid(-1,&WNOHANG);
> > > >>                    } until $kid == -1;
> > > > 
> > > > 
> > Yes WNOHANG makes waitpid return immediately the -1 means wait for any
> > child process. This code will do a non-blocking wait for all child 
> > processes.
> > 
> > It will be in the do-until loop until all of it's children are dead.
> > perldoc -f waitpid
> 
> This example is straight out of perldoc -f waitpid, but if it's
> used "as-is", I don't see the point. Why do a non-blocking wait,
> when the do loop effectively blocks the program anyway. You only
> want non-blocking when you have something else to do.
> 
> I would write the above as:
> 
>    1 while wait != -1;        # wait for all children
> 
> Or am I missing something?

I was not following this thread and was not aware exactly what the OP 
wanted. Yes this is straight out of perldoc -f waitpid. I just gave
an explanation for what the code in the post does not a suggestion to the 
OP's problem. Also I did not post this code, I guess the OP did it 
himself and asked for an explanation.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to