Help for this page

Select Code to Download


  1. or download this
    01 [
    02   [[0, 0], [0, 1], [0, 2], [0, 3]],
    ...
    02 $queue->enqueue(\@rows);
    03 my @threads = map { threads->create( \&process, $queue ); } 1 .. 4;
    04 ...
    
  2. or download this
    #! perl -slw
    use strict;
    ...
    
    $end = time;
    printf "Populating 1000x1000 AoAoAs and tranferring to another thread 
    +took: %.9fs\n", $end - $start;
    
  3. or download this
    c:\test>junk999
    Filling a 1000x1000 pixel image 1-pixel at a time took: 6.491771936s
    Populating 1000x1000 AoAoAs and tranferring to another thread took: 30
    +.876082897s
    
  4. or download this
    # main thread
    my( $X, $Y ) = ...;
    ...
    while( my( $x, $y ) = @{ $Q->dequeue } ) {
        $image->setpixel( $_, $y, ... ) for 0 .. $X-1;
    }
    
  5. or download this
    ## main
    for my $y ( 0 .. $Y ) {
    ...
    while( my( $y, @colors ) = @{ $Q->dequeue } ) {
        $image->setpixel( $_, $y, $colors[ $_ ] ) for 0 .. $#colors;
    }