我有一个Perl程序。一切都很好,但我看到下面的错误。我最后也加入了线程,并尝试检查is_joinable
,但没有任何工作。此错误目前没有引起任何问题,但我想解决它
Perl exited with active threads:
6 running and unjoined
0 finished and unjoined
0 running and detached
my @threads;
open FILE, "$inputCsv" or die $!;
my @records = <FILE>;
foreach $record ( @records ) {
@fields = split( /,/, $record );
$identityDomain = $fields[0];
push( @threads, threads->new( \&populateSubscriptionMap, $identityDomain ) );
}
foreach $thr ( @threads ) {
print "threads - " . $thr;
my %myhash = $thr->join();
}
我花了将近3个小时来尝试各种各样的事情。如果有人可以看看并帮助我,我将不胜感激。
答案 0 :(得分:2)
$_->join() for threads->list();
是一种等待所有线程结束的简单方法,但是你的问题更可能是你实际上没有达到代码的一部分。最可能的罪魁祸首是:
exit
。