3
我想使用線程與mod_perl結合使用,使用線程的mod_perl
的示例中,我使用下面的腳本:
use strict;
use warnings;
use threads;
sub doOperation{
my $vr = $_[0];
my $i = 0;
while($i < 10000000){
$i++
}
print "Thread done! var1 = $vr\n";
threads->exit();
}
my @thr;
$thr[0] = threads->create(\&doOperation,5);
$thr[1] = threads->create(\&doOperation,6);
foreach(@thr){ $_->join(); }
我工作的順利使用CLI:
# perl multithr.pl
Thread done! var1 = 6
Thread done! var1 = 5
但是,如果運行它通過Apache mod_perl模塊導致分段錯誤。
我的環境:
CentOS-6.5 x86_64
httpd-2.2.15
mod_perl-2.0.4
怎麼樣?請舉例說明 – swserg