sigaction passes SIGINT to system call, but not signal

孤街浪徒 提交于 2019-12-01 09:34:31

On BSD and Linux, signal() is equivalent to sigaction() with sa_flags set to SA_RESTART. If you set that flag in your sigaction() code, it will behave the same as your signal() code. If that's not what you want, then you must only use sigaction().

Notes from the Linux man page (which also apply to BSD and OS X):

On BSD, when a signal handler is invoked, the signal disposition is not reset, and further instances of the signal are blocked from being delivered while the handler is executing. Furthermore, certain blocking system calls are automatically restarted if interrupted by a signal handler (see signal(7)). The BSD semantics are equivalent to calling sigaction(2) with the following flags:

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