- or download this
my @threads = map {
## create the workers passing the log file handle and semaphore
threads->create( \&worker, $log, \$logSem,$_*$N, $_*$N + $N -1);
} 0 .. 5; ## 5 threads each processing 100 "files"
- or download this
my @threads = map{
threads->create( \&worker, $log, \$logSem, $from + ($_ - 1), $t, $to
+) ;
} 1 .. $t ;
- or download this
my( $log, $semRef, $from, $step, $to ) = @_;
for (my $file = $from ; $file <= $to ; $file += $step) {
......
} ;