spaz has asked for the wisdom of the Perl Monks concerning the following question:
My question is this:foreach $item ( @array ) { if( $pid = fork ) { print "Forking off to $pid\n"; } elsif( defined $pid ) { &proprietary_function( $item ); print "Done with function\n"; exit; } else { die "Can't fork: $!"; } }
And then changesub REAPER { my $waitedpid = wait; $SIG{CHLD} = \&REAPER; }
Toif( $pid = fork ) { print "Forking off to $pid\n";
?if( $pid = fork ) { $SIG{CHLD} = \&REAPER; print "Forking off to $pid\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Waiting..
by TheoPetersen (Priest) on Feb 23, 2001 at 03:10 UTC | |
|
Re: Waiting..
by mikfire (Deacon) on Feb 23, 2001 at 03:35 UTC | |
|
Re: Waiting..
by merlyn (Sage) on Apr 16, 2001 at 21:33 UTC |