On Fri, 24 Sep 2004 10:34:50 -0500, Errin Larsen <[EMAIL PROTECTED]> wrote:
> On Fri, 24 Sep 2004 17:20:44 +0200, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> > From: Errin Larsen <[EMAIL PROTECTED]>

<<SNIP>>


> 
> how do I wait() or waitpid() on more than one process?  don't both of
> those make the wait()ing process sit still and do nothing else until
> it gets a return?  I'll read perlipc again (man that's a hard one to
> grok) and see what it says.
> 
> --Errin
> 

Well, I found the following code snippet in perlipc:

sub REAPER {
  my $child;
  while( ( $child = waitpid( -1, WNOHANG ) ) > 0 ) {
    $Kid_Status{$child} = $?;
  }
  $SIG{CHLD} = \&REAPER;
}
$SIG{CHLD} = \&REAPER;

This seems to do something similar to what I want, but I'm confused
about exactly what it's doing.  what does the '-1' argument to
waitpid() do?  What is the 'WNOHANG' flag?  Why are we reassigning
'$SIG{CHLD}' to 'REAPER' inside of REAPER (this seems redundant to
me!)

I realize this is getting away from the "beginner" focus of this
mailing list, but I don't currently belong to any other mailing lists.
 Thanks for any help you can throw at me.

--Errin

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to