This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix various details in win32 makefiles and Config.pm setup.
[perl5.git] / ext / Thread / unsync3.t
1 use Thread;
2
3 $| = 1;
4
5 srand($$^$^T);
6
7 sub whoami {
8     my $thread = shift;
9     print $thread;
10 }
11
12 sub uppercase {
13     my $count = 100;
14     while ($count--) {
15         my $i = int(rand(1000));
16         1 while $i--;
17         print "A";
18         $i = int(rand(1000));
19         1 while $i--;
20         whoami("B");
21     }
22 }
23         
24 sub lowercase {
25     my $count = 100;
26     while ($count--) {
27         my $i = int(rand(1000));
28         1 while $i--;
29         print "x";
30         $i = int(rand(1000));
31         1 while $i--;
32         whoami("y");
33     }
34 }
35         
36 sub numbers {
37     my $count = 100;
38     while ($count--) {
39         my $i = int(rand(1000));
40         1 while $i--;
41         print 1;
42         $i = int(rand(1000));
43         1 while $i--;
44         whoami(2);
45     }
46 }
47         
48 new Thread \&numbers;
49 new Thread \&uppercase;
50 new Thread \&lowercase;