Thread shared vars (19 answers)
Opened by Froschpopo at 2005-04-07 23:45

esskar
 2005-04-08 01:05
#53564 #53564
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl

use warnings;
use strict;
use threads;
use threads::shared;

my $var : shared = 0;

my $th_inc = threads->new( \&kind );

sub kind {
   $var++;
   return 0;
}

while(!$var) {
 print "var: $var\n";
}

print "var: $var\n";
\n\n

<!--EDIT|esskar|1112907978-->

View full thread shared vars