On 3/21/06, Octavian Rasnita <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have tried the following script:
> use threads;
> my $threads = async {foreach(1 .. 70) {download($_)}};
This creates a single thread to execute the block. The choice between
$threads->create and async has to do with whether you're compfortable
with the oo interface, and whether you want to execute a block or a
sub. If you want 70 threads, do something like:
my @threads;
foreach (1..70) {
push @threads, threads->create("download", $_);
# or async {download($_)};
}
foreach (@threads) {
print "thread " $_->tid . " returned " . $_->join . "\n";
}
At least that's how I remeber it working.
HTH,
-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential
daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org
values of β will give rise to dom!