http://qs321.pair.com?node_id=509586

JFarr has asked for the wisdom of the Perl Monks concerning the following question:

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:
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; }
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