How do i remove a signal handler

跟風遠走 提交于 2019-12-06 17:27:08

问题


I've made the follow signal handler

struct sigaction pipeIn;
pipeIn.sa_handler = updateServer;
sigemptyset(&pipeIn.sa_mask);
sa.sa_flags = SA_RESTART;

if(sigaction(SIGUSR1, &pipeIn, NULL) == -1){

    printf("We have a problem, sigaction is not working.\n");
    perror("\n");
    exit(1);    

}

How do I remove or block this particular handler so that I can set up another signal handler that uses the same signal? Thanks.


回答1:


Use SIG_DFL in place of the function pointer when calling sigaction(2).



来源:https://stackoverflow.com/questions/9302464/how-do-i-remove-a-signal-handler

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