in reply to Re: hash elements are lost during reaping
in thread hash elements are lost during reaping
Thanks for the reply. My fork routine saves pids of children in another hash to be compared in the processing routine:
sub StartJob { my $pid; my $sid = shift; FORK: { if ($pid = fork) { # # This is the dispatcher! # $JobPIDs{$pid} = $sid; # add pid, sid pair to th +e hash } elsif ($pid == 0) { ....
The processing routine goes like this:
%TrappedPIDs is a global hash. How come it can be different?foreach $pid ( keys(%TrappedPIDs) ) { $rc = $TrappedPIDs{$pid}; print " CHECKING: trapped pid: $pid RC: $rc \n"; if ( exists($JobPIDs{$pid}) and $rc == 0 ) { # do the processing .. }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: hash elements are lost during reaping
by roboticus (Chancellor) on Dec 11, 2012 at 11:41 UTC |
In Section
Seekers of Perl Wisdom