- or download this
my $count = 100_000;
my $num_calls = 4;
...
inc() for 1..$num_calls;
print("$sum\n"); # 400000
- or download this
use threads;
use threads::shared;
...
$_->join for map { threads->create( \&inc ) } 1..$num_calls;
print("$sum\n"); # 314813
- or download this
+=======================+
| CPU |
...
| save $sum | |
| ... | |
+===========+===========+
- or download this
use threads;
use threads::shared;
...
$_->join for map { threads->create( \&inc ) } 1..$num_calls;
print("$sum\n"); # 400000
- or download this
++s sum = 233564 (expecting 400000)
s+=1 sum = 143915 (expecting 400000)
c.=l length = 248149 (expecting 400000)
c=c.l length = 123360 (expecting 400000)
- or download this
use v5.8.0;
...
print("c=c.l length = " . length($content) .
" (expecting " . ($count*$threads). ")\n");
}