Make #11082 more OS/2-specific.
[p5sagit/p5-mst-13.2.git] / ext / Thread / unsync3.tx
CommitLineData
0fcb073c 1BEGIN {
2 eval { require Config; import Config };
3 if ($@) {
4 print "1..0 # Skip: no Config\n";
5 exit(0);
6 }
7 if ($Config{extensions} !~ /\bThread\b/) {
8 print "1..0 # Skip: no use5005threads\n";
9 exit(0);
10 }
11}
12
d9bb3666 13use Thread;
14
15$| = 1;
16
17srand($$^$^T);
18
19sub whoami {
20 my $thread = shift;
21 print $thread;
22}
23
24sub uppercase {
25 my $count = 100;
26 while ($count--) {
27 my $i = int(rand(1000));
28 1 while $i--;
29 print "A";
30 $i = int(rand(1000));
31 1 while $i--;
32 whoami("B");
33 }
34}
35
36sub lowercase {
37 my $count = 100;
38 while ($count--) {
39 my $i = int(rand(1000));
40 1 while $i--;
41 print "x";
42 $i = int(rand(1000));
43 1 while $i--;
44 whoami("y");
45 }
46}
47
48sub numbers {
49 my $count = 100;
50 while ($count--) {
51 my $i = int(rand(1000));
52 1 while $i--;
53 print 1;
54 $i = int(rand(1000));
55 1 while $i--;
56 whoami(2);
57 }
58}
59
60new Thread \&numbers;
61new Thread \&uppercase;
62new Thread \&lowercase;