in reply to Using Perl to run a Windows command-line utility many times with ordered, parallel execution
Just add the DATA :)
#! perl -slw use strict; use threads stack_size => 4096; use threads::Q; sub thread { my $Q = shift; while( my $item = $Q->dq ) { system qq[ doit.exe $item ]; } } our $T //= 20; my @ordered_arguments = <DATA>; chomp @ordered_arguments; my $Q = threads::Q->new( $T * 2 ); my @threads = map async( \&thread, $Q ), 1 .. $T; $Q->nq( $_ ) for @ordered_arguments; $Q->nq( (undef) x $T ); $_->join for @threads; __DATA__ ...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Using Perl to run a Windows command-line utility many times with ordered, parallel execution
by jellisii2 (Hermit) on Jan 27, 2014 at 18:10 UTC | |
by BrowserUk (Patriarch) on Jan 27, 2014 at 20:09 UTC | |
by Jim (Curate) on Apr 17, 2014 at 00:35 UTC | |
by BrowserUk (Patriarch) on Apr 17, 2014 at 02:30 UTC |