perlquestion
JFarr
Hello Monks,
I have a thread question that I have not been able to solve.
I receive this error message:
A thread exited while 7 threads were running, <FILE> line 15.
I'm using "use threads" and "use threads::shared".
basically I have this setup:
<code>
foreach $host (@syshost)
{
$threadHost = threads->new(\&runSeries, $host);
}
sub runSeries
{
my $stuff = @_;
< parse through $stuff...and do data manipulation>
$threadStuff = threads->new(\&PrintOut, $stuff)->join;
}
</code>
PrintOut just prints data to the screen.
I know that if I use a join in the first thread call, my problem goes away, except that this drastically slows the program down.
Is there a way to stop the first thread from exiting until all the other threads are finsished?
Thanks