Try the new test scanning scheme on Text::Abbrev.
[p5sagit/p5-mst-13.2.git] / ext / Thread / unsync.t
CommitLineData
d9bb3666 1use Thread;
2
3$| = 1;
4
5if (@ARGV) {
6 srand($ARGV[0]);
7} else {
8 my $seed = $$ ^ $^T;
9 print "Randomising to $seed\n";
10 srand($seed);
11}
12
13sub whoami {
14 my ($depth, $a, $b, $c) = @_;
15 my $i;
16 print "whoami ($depth): $a $b $c\n";
17 sleep 1;
18 whoami($depth - 1, $a, $b, $c) if $depth > 0;
19}
20
21sub start_foo {
22 my $r = 3 + int(10 * rand);
23 print "start_foo: r is $r\n";
24 whoami($r, "start_foo", "foo1", "foo2");
783070da 25 print "start_foo: finished\n";
d9bb3666 26}
27
28sub start_bar {
29 my $r = 3 + int(10 * rand);
30 print "start_bar: r is $r\n";
31 whoami($r, "start_bar", "bar1", "bar2");
783070da 32 print "start_bar: finished\n";
d9bb3666 33}
34
35$foo = new Thread \&start_foo;
36$bar = new Thread \&start_bar;
37print "main: exiting\n";