Explicitly invoke SIG_DFL/SIG_IGN handlers on Linux

后端 未结 3 373
执念已碎
执念已碎 2020-12-21 22:12

I\'ve blocked, and then waited for a signal via the following code:

sigset_t set;
sigfillset(&set); // all signals
sigprocmask(SIG_SETMASK, &set, NUL         


        
3条回答
  •  春和景丽
    2020-12-21 23:03

    I'm not aware of the way to do it.

    Only suggestion I have is to look into the man 7 signal and perform manually the action according the table you see there. Ign is nothing. Core is call to abort(). Term is _exit().

    Of course you can also set signal handler back to SIG_DFL and then kill(getpid(),THE_SIG) (or its equivalent raise(THE_SIG)). (I personally do not like raise because on some systems it might produce some messages on stderr.)

提交回复
热议问题