in reply to Re: $? is -1???
in thread $? is -1???
No, the parent just waits around doing nothing (except sleeping).
On your advice, I tried removing the SIGCHLD handler, but taking the contents into the wait loop in the parent, so it now does:
while ($children) { while ((my $pid = waitpid(-1, &WNOHANG)) > 0) { print "$?\n" if $?; delete $children{$pid}; $children--; print "$children children running\n"; } sleep; }
where it used to just sleep
However, this never terminated for me. My child processes become zombies and waitpid() never gives me anything back and I just loop forever. I also tried looping through the keys of the %children hash and waiting on each PID, but that didn't work any better for me. Am I misunderstanding something about your technique?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: $? is -1???
by bluto (Curate) on Jun 21, 2004 at 22:35 UTC | |
by kscaldef (Pilgrim) on Jun 21, 2004 at 23:00 UTC | |
by bluto (Curate) on Jun 21, 2004 at 23:02 UTC |