The stupid question is the question not asked | |
PerlMonks |
hash elements are lost during reapingby umitd (Initiate) |
on Dec 11, 2012 at 10:42 UTC ( [id://1008261]=perlquestion: print w/replies, xml ) | Need Help?? |
umitd has asked for the wisdom of the Perl Monks concerning the following question: I have a perl program which forks children and does some processing depending on how each child exits. I keep the exited child's pid and return code in a hash to process later:
My program can only trap some of the children exited. Some others exit, but never detected by my foreach loop. So my program thinks that they are still running. So I modified the reaper routine to print all trapped PIDs of exited children:
This printed the following:
TRAPPED PIDS: 20090 19934 I also added a print command to my processing routine. It only checks 20092! So it seems that hash %TrappedPIDs ended up having just one PID despite the fact that the reaper routine caught more PIDs and added them to the hash! I understand that reaper routine itself can be interrupted with the signals of children which died around the same time. However, this should not destroy the elements of the hash. What am I doing wrong here?
Back to
Seekers of Perl Wisdom
|
|