Help for this page

Select Code to Download


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