| Revision: | 1.1 |
| Committed: | Thu Jun 30 14:27:05 2005 UTC (21 years, 3 months ago) by root |
| Branch: | MAIN |
| CVS Tags: | PERL-5-8-7, HEAD |
| Branch point for: | PERL |
| Log Message: | *** empty log message *** |
| # | Content |
|---|---|
| 1 | BEGIN { |
| 2 | eval { require Config; import Config }; |
| 3 | if ($@) { |
| 4 | print "1..0 # Skip: no Config\n"; |
| 5 | exit(0); |
| 6 | } |
| 7 | } |
| 8 | |
| 9 | use Thread; |
| 10 | |
| 11 | $| = 1; |
| 12 | |
| 13 | srand($$^$^T); |
| 14 | |
| 15 | sub whoami { |
| 16 | my $thread = shift; |
| 17 | print $thread; |
| 18 | } |
| 19 | |
| 20 | sub uppercase { |
| 21 | my $count = 100; |
| 22 | while ($count--) { |
| 23 | my $i = int(rand(1000)); |
| 24 | 1 while $i--; |
| 25 | print "A"; |
| 26 | $i = int(rand(1000)); |
| 27 | 1 while $i--; |
| 28 | whoami("B"); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | sub lowercase { |
| 33 | my $count = 100; |
| 34 | while ($count--) { |
| 35 | my $i = int(rand(1000)); |
| 36 | 1 while $i--; |
| 37 | print "x"; |
| 38 | $i = int(rand(1000)); |
| 39 | 1 while $i--; |
| 40 | whoami("y"); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | sub numbers { |
| 45 | my $count = 100; |
| 46 | while ($count--) { |
| 47 | my $i = int(rand(1000)); |
| 48 | 1 while $i--; |
| 49 | print 1; |
| 50 | $i = int(rand(1000)); |
| 51 | 1 while $i--; |
| 52 | whoami(2); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | new Thread \&numbers; |
| 57 | new Thread \&uppercase; |
| 58 | new Thread \&lowercase; |