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" #### my @threads = map{ threads->create( \&worker, $log, \$logSem, $from + ($_ - 1), $t, $to) ; } 1 .. $t ; #### my( $log, $semRef, $from, $step, $to ) = @_; for (my $file = $from ; $file <= $to ; $file += $step) { ...... } ;
## my @threads = map{ threads->create( \&worker, $log, \$logSem, $from + ($_ - 1), $t, $to) ; } 1 .. $t ; ##
## my( $log, $semRef, $from, $step, $to ) = @_; for (my $file = $from ; $file <= $to ; $file += $step) { ...... } ;