Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Threads From Hell #3: Missing Some Basic Prerequisites

by BrowserUk (Patriarch)
on May 30, 2015 at 19:48 UTC ( [id://1128422]=note: print w/replies, xml ) Need Help??

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;
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-26 08:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found