On Tue, 13 Aug 2002, Ahmed Moustafa wrote:

> Ahmed Moustafa wrote:
> > Drieux wrote:
> > 
> >>
> >>
> >>                    use POSIX ":sys_wait_h";
> >>                    #...
> >>                    do {
> >>                        $kid = waitpid(-1,&WNOHANG);
> >>                    } until $kid == -1;
> > 
> > 
> > Does the execution of the program wait to all the forked processes to 
> > terminate?
> 
> Perl Cookbook says "We use the WNOHANG flag to make waitpid immediately 
> return 0 if there are no dead children".

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.

> 
> So, the above code doesn't pause the program, does it?

It will be in the do-until loop until all of it's children are dead.
perldoc -f waitpid


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

Reply via email to