gpt4 book ai didi

linux - signal() 系统调用的现代版本是什么?

转载 作者:太空宇宙 更新时间:2023-11-04 11:52:22 26 4
gpt4 key购买 nike

我想知道现代版本的 signal() 系统调用是什么。

最佳答案

那就是 sigaction ,一种更灵活的信号处理方式。虽然设置起来有点费力,但它与旧版相比具有明显的优势 signal方法。

您只需查看第二个链接即可看到如下短语:

When a signal occurs, and func points to a function, it is implementation-defined whether …

… the behavior is undefined if the signal handler refers to any object other than errno

The sigaction() function provides a more comprehensive and reliable mechanism for controlling signals; new applications should use sigaction() rather than signal().

这应该能说服您使用更现代的变体。

关于linux - signal() 系统调用的现代版本是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55663299/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com