什么是信号功能(SIGINT)? [英] What is the Signal function (SIGINT)?
问题描述
以下这句话是做什么的?如果有人可以解释此功能,我将不胜感激.
What does this statement below do? If anyone can explain this function I would really appreciate it.
signal(SIGINT, SIG_DFL);
推荐答案
SIGINT是中断信号(ctrl + C).它的默认行为是终止该过程.可以配置SIGINT信号,这意味着可以更改默认行为(通过调用sighandler或将其设置为SIG_IGN) 现在,一旦操作更改,并且您想要再次将其设置为该信号的默认行为,则应编写
SIGINT is the interrupt signal (ctrl+C). Its default behaviour is to terminate the process. SIGINT signal can be dis-positioned, means one can change the default behaviour ( By calling sighandler, or setting it SIG_IGN ) Now once the action is changes and you want to set it again the default behaviour of this signal then you should write
signal(SIGINT,SIG_DFL);
signal(SIGINT, SIG_DFL);
它将再次更改信号的默认行为. (这将终止进程)
It will again change the default behaviour of the signal. ( which is to terminate a process )
这篇关于什么是信号功能(SIGINT)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!