Encode::Tcl.pm for iso-2022-(?:jp-[12]|cn)
[p5sagit/p5-mst-13.2.git] / ext / Thread / unsync2.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 printargs {
20 my $thread = shift;
21 my $arg;
22 my $i;
23 while ($arg = shift) {
24 my $delay = int(rand(500));
25 $i++;
26 print "$thread arg $i is $arg\n";
27 1 while $delay--;
28 }
29}
30
31sub start_thread {
32 my $thread = shift;
33 my $count = 10;
34 while ($count--) {
35 my(@args) = ($thread) x int(rand(10));
36 print "$thread $count calling printargs @args\n";
37 printargs($thread, @args);
38 }
39}
40
41new Thread (\&start_thread, "A");
42new Thread (\&start_thread, "B");
43#new Thread (\&start_thread, "C");
44#new Thread (\&start_thread, "D");
45#new Thread (\&start_thread, "E");
46#new Thread (\&start_thread, "F");
47
48print "main: exiting\n";