MOON
Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4
System: Linux vps.panamaemb.org.sg 3.10.0-1160.80.1.vz7.191.4 #1 SMP Thu Dec 15 20:31:06 MSK 2022 x86_64
User: panama (500)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //installd/perl588installer/perl-5.8.8/ext/Thread/unsync.tx
BEGIN {
    eval { require Config; import Config };
    if ($@) {
	print "1..0 # Skip: no Config\n";
	exit(0);
    }
}

use Thread;

$| = 1;

if (@ARGV) {
    srand($ARGV[0]);
} else {
    my $seed = $$ ^ $^T;
    print "Randomising to $seed\n";
    srand($seed);
}

sub whoami {
    my ($depth, $a, $b, $c) = @_;
    my $i;
    print "whoami ($depth): $a $b $c\n";
    sleep 1;
    whoami($depth - 1, $a, $b, $c) if $depth > 0;
}

sub start_foo {
    my $r = 3 + int(10 * rand);
    print "start_foo: r is $r\n";
    whoami($r, "start_foo", "foo1", "foo2");
    print "start_foo: finished\n";
}

sub start_bar {
    my $r = 3 + int(10 * rand);
    print "start_bar: r is $r\n";
    whoami($r, "start_bar", "bar1", "bar2");
    print "start_bar: finished\n";
}

$foo = new Thread \&start_foo;
$bar = new Thread \&start_bar;
print "main: exiting\n";