Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Multithreading 接收到信号SIGSTOP,但在perl脚本中未设置信号处理程序_Multithreading_Perl_Signals - Fatal编程技术网

Multithreading 接收到信号SIGSTOP,但在perl脚本中未设置信号处理程序

Multithreading 接收到信号SIGSTOP,但在perl脚本中未设置信号处理程序,multithreading,perl,signals,Multithreading,Perl,Signals,我的perl脚本中有以下代码,但似乎无法正常工作: my $thr; sub start__server_thread() { $thr = threads->create(\&iperf_start_server, $_[0], $_[1], $_[2]); print("Value of thread is $thr\n"); &START_SERVER_RESPONSE($controller_ip, $control

我的perl脚本中有以下代码,但似乎无法正常工作:

my $thr;

sub start__server_thread()
{
        $thr = threads->create(\&iperf_start_server, $_[0], $_[1], $_[2]);
        print("Value of thread is $thr\n");
        &START_SERVER_RESPONSE($controller_ip, $controller_port, "success", 2345, $_[1]);
}

sub iperf_start_server()
{
# Do some stuff here and then handle the signal
$SIG{'SIGSTOP'} = sub {
        print("Stop signal received\n");
        $thr->exit();
        $flag = 1;
        };
}

sub stop_server()
{
        my ($dat,$filelog,$result);
        $thr->kill('STOP');
        $flag = 1;
        sleep(10);
        $thr->exit(1);
}

当从其他上下文调用stop_server()时,它会尝试向线程发送SIGSTOP信号。正是在这一点上,执行停止,我得到了错误“Signal SIGSTOP received,但没有在perl脚本中设置信号处理程序。我哪里出错了?

您应该设置
$SIG{STOP}
,而不是
$SIG{SIGSTOP}


如果您
使用警告
,您将收到此错误的警报。如果您
使用诊断
,您将得到一些关于错误原因和修复方法的实用建议。

您应该设置
$SIG{STOP}
,而不是
$SIG{SIGSTOP}


如果您
使用警告
,您将收到此错误的警告。如果您
使用诊断
,您将得到一些关于错误原因和修复方法的实用建议。

--将Perl sub声明为
sub-name{…}
而不是
sub-name(){…}
。您在什么平台上运行此操作?我认为您的问题是无法捕获
停止
终止
信号。我正在Linux上尝试上述代码--将Perl sub声明为
sub-name{…}
而不是
sub-name(){…}
。您在什么平台上运行此操作?我认为您的问题是无法捕获
停止
终止
信号。我正在Linux上尝试上述代码,如果我添加使用警告和使用诊断,则这些代码没有帮助。如果我添加使用警告和使用诊断,则这些代码没有帮助