那么sigaction()和signal()有什么区别呢?
Possible Duplicate:
What is the difference between sigaction and signal?
It seems to me that both of them can be used to register a callback for a specific signal.
How do you choose which one to use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
TLPI
sigaction
也比signal
更易于移植。此外,使用sigaction
,您可以指定接收附加参数的信号处理程序(sa_sigaction
与sa_handler
)。TLPI
sigaction
is also more portable thansignal
. Also, withsigaction
you can specify signal handlers that receive additional arguments (sa_sigaction
versussa_handler
).从我的角度来看,区别(除了接口:)和可移植性)在于捕获信号后的行为:
而且,我还想重复一下手册页中所说的内容:
From my point of view, the difference (except interface :) and portability) is in behavior after signal is caught:
And, also I'd like to repeat the same as the man page says: