我有简单的多线程站点检查器。我尝试在此目录中打开循环 txt 文件
my @files = glob( '*.txt' );
foreach my $file(@files){
@sites=load_file($file);
$total_count = scalar(@sites);
for my $t (1..$threads) {
push @threads, threads->create(\&check, $t);#check- main subroutine
threads->create(\&stat)->join() if $t == $threads;#stat - realtime statistics(good/bads) sites
}
foreach my $t (@threads) {
$t->join();
}
}
但它仅适用于第一个文件和程序终止。任何人都可以帮忙吗?谢谢。