- Moved unused argc, temp variable into small scope.
[dragonfly.git] / contrib / perl5 / ext / Thread / unsync4.t
1 use Thread;
2
3 $| = 1;
4
5 srand($$^$^T);
6
7 sub printargs {
8     my(@copyargs) = @_;
9     my $thread = shift @copyargs;
10     my $arg;
11     my $i;
12     while ($arg = shift @copyargs) {
13         my $delay = int(rand(500));
14         $i++;
15         print "$thread arg $i is $arg\n";
16         1 while $delay--;
17     }
18 }
19
20 sub start_thread {
21     my(@threadargs) = @_;
22     my $thread = $threadargs[0];
23     my $count = 10;
24     while ($count--) {
25         my(@args) = ($thread) x int(rand(10));
26         print "$thread $count calling printargs @args\n";
27         printargs($thread, @args);
28     }
29 }
30
31 new Thread (\&start_thread, "A");
32 new Thread (\&start_thread, "B");
33 new Thread (\&start_thread, "C");
34 new Thread (\&start_thread, "D");
35 new Thread (\&start_thread, "E");
36 new Thread (\&start_thread, "F");
37
38 print "main: exiting\n";