What is the difference between sigaction and signal?

前端 未结 9 873
离开以前
离开以前 2020-11-22 06:23

I was about to add an extra signal handler to an app we have here and I noticed that the author had used sigaction() to set up the other signal handlers. I was

9条回答
  •  梦谈多话
    2020-11-22 06:52

    They're different interfaces for OS's signal facilities. One should prefer using sigaction to signal if possible as the signal() has implementation-defined (often race prone) behavior and behaves differently on Windows, OS X, Linux and other UNIX systems.

    See this security note for details.

提交回复
热议问题