exec never returns on success, so for(my $ct = 0; $ct <= $#forkArray; $ct+=3) never gets to execute its body more than once.
You never check if fork or exec succeeds.
You never reap your children.
If I'm not mistaken, you run in the parent what you want to run in the child.
The way in which @forkArray is used is not optimally readable.
for (...) { ... push(@forkArray, $level); push(@forkArray, $writeCounter); push(@forkArray, $nextMerge); } for (my $ct = 0; $ct <= $#forkArray; $ct+=3) { my $level = $forkArray[$ct+0]; my $mergeLast = $forkArray[$ct+1]; my $mergeFirst = $forkArray[$ct+2]; ... }
reads better as
for (...) { ... push @forkArray, [ $level, $writeCounter, $nextMerge ]; } foreach (@forkArray) { my ($level, $mergeLast, $mergeFirst) = $@_; ... }
In reply to Re: meddling with forces I can't understand
by ikegami
in thread meddling with forces I can't understand
by downer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |