sigaction: restore handler or not?

筅森魡賤 提交于 2019-12-11 05:30:02

问题


if i call sigaction at the beginning of my code,

sigaction(SIGPIPE, &pipe_act, NULL);

if i receive sigpipe, after the execution of pipe_act the handler installed remains pipe_Act, or the default handler is automatically set for sigpipe?


回答1:


It depends on whether or not your flags (pipe_act->sa_flags) include SA_RESETHAND. If yes, then the signal handler is a "one-shot" and gets removed after having been called (i.e. the handler is reset to the default handler), but if not, then the handler remains in place until you change it manually.



来源:https://stackoverflow.com/questions/12597915/sigaction-restore-handler-or-not

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