Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Threading in Perl

Status
Not open for further replies.

tzhong

MIS
Mar 22, 2001
11
US
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
 
Try printing the output to independent text files. There may be some issue with STDOUT not being accessible from different PID's

Just a thought
--Paul

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top