> On Feb 18, 2004, at 3:50 PM, Papo Napolitano wrote:
> 
> > Hi!
> >
> > I'm using the "select undef, undef, undef, 60" trick to sleep for 60
> > seconds.
> > But it seems to not work after I do a couple of forks like this:
> >
> > while (1) {
> >   Fork('sub1');
> >   Fork('sub2');
> >   Fork('sub3');
> >   select undef, undef, undef, 60;
> 
> This can be simplified to:
> 
> sleep 60;
> 
> > }
> >
> > "Fork" just fork and run the supplied sub in the new child, returning 
> > to the
> > parent.
> > Any clue as to what could be causing this behaviour?
> 
> Let's see the Fork() subroutine please.  I suspect the problem is 
> there.  You're forking multiple times inside an infinite loop, which is 
> plenty scary.  If you're not exiting child processes properly, that's 
> going to get big fast.
> 
> James


Heh, sorry... I simplified the code...
I'm still not posting the full source because it's like 15 files :(


while (1) {
  Fork("Whatever");
  sleep 60;
}

sub Fork {
  my $module = shift;
  my @params = @_;
  my $pid = fork;
  return $pid if $pid;
  $module->Run(@params);
  exit;
}


The modules I'm testing are only this:


package Whatever;

sub Run {
  my $self = shift;
  my $param = shift;
  print STDERR "$self: $param\n";
  exit;
}


Uhmmm, sleep isn't working neither...
Thanks!

-- 
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