我用 Perl 写了一个非常简短的脚本,并在其中使用multi-thread
了它。
我的问题是,我创建的线程不是joinable
. 所以我想知道,使线程可连接的条件是什么?
Perl 中线程的限制是什么?
#!/usr/bin/env perl
#
#
use lib "$::XCATROOT/lib/perl";
use strict;
use threads;
use Safe;
sub test
{
my $parm = shift;
}
my $newchassis = ["1", "2", "3"];
my @snmp_threads ;
for my $item (@$newchassis)
{
my $thread = threads->create(\&test, $item);
push @snmp_threads, $thread;
}
for my $t (@snmp_threads)
{
$t->join();
}
这可能非常棘手,因为它可以在 RHEL 6.3 上找到,但在 SLES 11sp2 上失败。