Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Threads and print

by gone2015 (Deacon)
on Apr 16, 2009 at 08:53 UTC ( #757901=note: print w/replies, xml ) Need Help??

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) {
      ......
      } ;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://757901]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2023-12-02 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (13 votes). Check out past polls.

    Notices?