in reply to Re: Simple Parallel Processing Question
in thread Simple Parallel Processing Question
This is wonderfully simple! Where yesterday I processed sequentially like this:
... foreach (@jobs) { &process($_); } ...
Today, in parallel with just a few changes ripped from 'afork':
... foreach (@jobs) { die "Fork failed: $!\n" unless defined (my $pid = fork); exit &process($_) unless $pid; } 1 until -1 == wait; ...
And restrained parallel with three more lines:
... my $max = 4; my $c = 0; foreach (@jobs) { wait unless ++$c <= $max; die "Fork failed: $!\n" unless defined (my $pid = fork); exit &process($_) unless $pid; } 1 until -1 == wait; ...
I wonder where the once-prominent abigail is today...
|
|---|