I am trying to do some threading with perl, and my simple script just refuses to work:
#!C:/perl/bin/perl.exe
use strict;
use IO::Socket;
use Thread;
use Config;
$Config{useithreads} or die "Recompile Perl with threads to run this program.";
sub foo2 {
sleep(5);
print "foo2";
print "T2 is done";
}
sub foo1 {
sleep(2);
print "foo1";
my $t2 = new Thread \&foo2;
print "T2 is launched";
}
# Start a listening socket to server cross domain policy file
$\ = "\n";
my $t1 = new Thread \&foo1;
print "T1 is launched";
The Output:
T1 is launched
foo1
Apparently thread T2 is not even started. What's wrong?
Thanks,
Tim
#!C:/perl/bin/perl.exe
use strict;
use IO::Socket;
use Thread;
use Config;
$Config{useithreads} or die "Recompile Perl with threads to run this program.";
sub foo2 {
sleep(5);
print "foo2";
print "T2 is done";
}
sub foo1 {
sleep(2);
print "foo1";
my $t2 = new Thread \&foo2;
print "T2 is launched";
}
# Start a listening socket to server cross domain policy file
$\ = "\n";
my $t1 = new Thread \&foo1;
print "T1 is launched";
The Output:
T1 is launched
foo1
Apparently thread T2 is not even started. What's wrong?
Thanks,
Tim