in reply to Re: making fork() a flag, and wait()ing properly
in thread making fork() a flag, and wait()ing properly
Nice! Your last example of:
foreach my $node ( @devices ) { if( $do_fork ) { my $pid = fork(); if( !$pid ) { do_exciting_things(); exit 0; } } else { do_exciting_things(); } }
looks very much like my most recent rewrite after starting this thread, so i am very encouraged that I am actually starting to understand what it is you dudes actually are talking about :-)
maybe though you could clear up the fog for me on this:
use POSIX; my $do_fork = 1; $SIG{CHLD} = sub { while( ( my $pid = waitpid(-1, POSIX::WNOHANG()) ) > 0 ){ ... } }
this one has me scratching my head. if you'd rather point to a perldoc reference, i'm up for that as well. it looks as though you're defining a subroutine as a hash value, but i'm not certain where/how its being called.
thanks -c
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: making fork() a flag, and wait()ing properly
by lestrrat (Deacon) on Feb 08, 2002 at 19:41 UTC |
In Section
Seekers of Perl Wisdom