[英]using threads in mod_perl
I want to use threads with mod_perl, 我想使用mod_perl的线程,
as a sample I use following script: 作为示例,我使用以下脚本:
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(); }
I works smooth using CLI: 我使用CLI顺利工作:
# perl multithr.pl
Thread done! var1 = 6
Thread done! var1 = 5
However if run it through Apache mod_perl module it causes Segmentation fault error. 但是,如果通过Apache mod_perl模块运行它会导致分段错误。
My Environment: 我的环境:
CentOS-6.5 x86_64
httpd-2.2.15
mod_perl-2.0.4
threads->exit(); threads->出口();
This statement raised Segmentation fault error. 此语句引发了Segmentation fault错误。 Exit thread properly! 正确退出线程!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.