use Thread::Pool; $pool = Thread::Pool->new( { do => sub {shift; print "do(@_)\n"; return $result; }, workers => 20, }, ); # then you submit your jobs foreach(keys %jobs) { $ids{$_} = $pool->job(...arguments to do...); } while(keys %ids) { foreach(keys %ids) { if(@result = $pool->result_dontwait($_)) { $results{$_} = [@result]; delete($ids{$_}); } } }
In reply to Re: Threading Woes
by jasonk
in thread Threading Woes
by crackotter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |