S
sangeetha
Hello,
Yesterday, i have started reading thread model programming in perl. (
using Programming PERL by Larry wall, Tom, Jon). The following
programming has been given to explain the LOCK CONCEPT and given that
output of this program is "2". But, i'm getting "0" only. Any help y
it is?
I'm using "v5.8.0 built for i386-linux-thread-multi" version of perl.
##############################################
use Thread qw/async yield/;
my $var=0;
sub abump {
if ( $var == 0 ){
yield;
$var++;
}
}
my $t1 = new Thread \&abump;
my $t2 = new Thread \&abump;
for my $t ( $t1, $t2 ) { $t ->join; }
print "var is $var\n";
##############################################
If my understanding is wrong please explain. What is the exact use of
"yield" in the thread model programming. Thanks a lot.
Sangeetha
Yesterday, i have started reading thread model programming in perl. (
using Programming PERL by Larry wall, Tom, Jon). The following
programming has been given to explain the LOCK CONCEPT and given that
output of this program is "2". But, i'm getting "0" only. Any help y
it is?
I'm using "v5.8.0 built for i386-linux-thread-multi" version of perl.
##############################################
use Thread qw/async yield/;
my $var=0;
sub abump {
if ( $var == 0 ){
yield;
$var++;
}
}
my $t1 = new Thread \&abump;
my $t2 = new Thread \&abump;
for my $t ( $t1, $t2 ) { $t ->join; }
print "var is $var\n";
##############################################
If my understanding is wrong please explain. What is the exact use of
"yield" in the thread model programming. Thanks a lot.
Sangeetha