Signal SIGSTOP received, but no signal handler set in perl script

☆樱花仙子☆ 提交于 2020-04-16 04:59:31

问题


I have the following code in my perl script which somehow doesn't seem to work:

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);
}

When from some other context stop_server() is called, it tries to send the SIGSTOP signal to the thread. It is at this point that the execution stops and I get the error "Signal SIGSTOP received, but no signal handler set in perl script. Where have i gone wrong?


回答1:


You should be setting $SIG{STOP}, not $SIG{SIGSTOP}.

If you use warnings, you would have been alerted to this error. And if you use diagnostics, you would get some practical advice on what caused the error and how to fix it.



来源:https://stackoverflow.com/questions/17952516/signal-sigstop-received-but-no-signal-handler-set-in-perl-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!