PERL语言中怎么捕获信号量9
PERL语言中如何捕获信号量9
难道用户态进程捕获不到内核态信号?
------解决方案--------------------
可以把 %SIG 句柄设置为字串“IGNORE”或者“DEFAULT”,这样,Perl 就会试图丢弃该信号或者允许用缺省动作处理该信号,不过有些信号既不能捕获,也不能忽略,比如 KILL 和 STOP 信号
Some signals can be neither trapped nor ignored, such as the KILL and STOP (but not the TSTP) signals.
http://perldoc.perl.org/perlipc.html
------解决方案--------------------
SIGKILL和SIGSTOP不能捕获吧。
local $SIG{TERM}=sub{tryStop();}; # 可以捕获到kill
local $SIG{INT}=sub{tryStop();}; # 可以捕获到ctrl+c
local $SIG{KILL}=sub{tryStop();}; # 捕获不到kill -9啊
难道用户态进程捕获不到内核态信号?
------解决方案--------------------
可以把 %SIG 句柄设置为字串“IGNORE”或者“DEFAULT”,这样,Perl 就会试图丢弃该信号或者允许用缺省动作处理该信号,不过有些信号既不能捕获,也不能忽略,比如 KILL 和 STOP 信号
Some signals can be neither trapped nor ignored, such as the KILL and STOP (but not the TSTP) signals.
http://perldoc.perl.org/perlipc.html
------解决方案--------------------
SIGKILL和SIGSTOP不能捕获吧。