Providing/passing argument to signal handler

后端 未结 7 1144
夕颜
夕颜 2020-12-02 10:29

Can I provide/pass any arguments to signal handler?

/* Signal handling */
struct sigaction act;
act.sa_handler = signal_handler;
/* some more settings */


        
相关标签:
7条回答
  • 2020-12-02 11:18

    Absolutely. You can pass integers and pointers to signal handlers by using sigqueue() instead of the usual kill().

    http://man7.org/linux/man-pages/man2/sigqueue.2.html

    0 讨论(0)
提交回复
热议问题