perlquestion
armcinto
<p>
Hi Monks,<br>
I'm stuck and need some direction. I have a new script that is frequently hanging and needs to be killed. The script reads in a file with a list of hostnames (4-5) and creates a thread for each hostname. I can see the print statement that each thread is created, but I don't see the first print statement in the runMain subroutine. Most of threads complete the entire script, but 1-2 will appear to never start. Not sure what else to try at this point to get more information. This is Strawberry Perl (64-bit) 5.28.1.1-64bit environment.
</p>
<code>
sub runMain
{
print "Starting runMain on $_[0]\n";
if ($_[0] =~ /(\w.+\w\d+.+net),(\w+)/)
{
$Server = $1;
$Type = $2;
print "Connecting to $Server\n";
}
}
open (LIST, "list.txt");
for my $Serv (<LIST>)
{
print "Created thread for $Serv\n";
push @Threads, threads->new(sub {runMain($Serv)});
}
</code>
<br><br>
Thanks,<br>
-A