我知道 raise(SIGABRT)
和 abort()
方法都会向自身发送 SIGABRT 信号。但是这两个功能之间有一些区别。 (例如 - abort()
函数解锁 SIGABRT 信号,而 raise(SIGABRT)
则不会。)
raise(SIGABRT)
和 abort()
方法之间的其他区别是什么
最佳答案
主要区别在于 abort()
如果 SIGABRT
被忽略,甚至会结束进程。
逐字记录来自 man abort
:
If the SIGABRT signal is ignored, or caught by a handler that returns, the abort() function will still terminate the process. It does this by restoring the default disposition for SIGABRT and then raising the signal for a second time.
关于c++ - raise(SIGABRT) 和 abort() 方法之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20212927/