Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Implement Queue mechanism in Perl

by BrowserUk (Pope)
on Jan 11, 2011 at 07:15 UTC ( #881610=note: print w/ replies, xml ) Need Help??

in reply to Implement Queue mechanism in Perl

#! perl -slw use strict; use Time::HiRes qw[ sleep ]; use threads; use threads::shared; my @commands = map { my $t = 2+int( rand 5 ); qq[ perl -E"sleep 1 while ++\$n < $t" ]; } 1 .. 300; my $running :shared = 0; my $done :shared = 0; for my $cmd ( @commands ) { async{ ++$running; system $cmd; --$running; ++$done; }->detach; printf( "\r$done, $running" ), sleep 0.1 while $running > 2; }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Comment on Re: Implement Queue mechanism in Perl
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2015-11-26 05:29 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (696 votes), past polls