What is the difference between sigaction and signal?

前端 未结 9 799
离开以前
离开以前 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:54

    To me, this below line was enough to decide:

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

    http://pubs.opengroup.org/onlinepubs/009695399/functions/signal.html#tag_03_690_07

    Whether you're starting from scratch or modifying an old program, sigaction should be the right option.

提交回复
热议问题