Catching signal inside its own handler

后端 未结 5 661
抹茶落季
抹茶落季 2021-01-11 10:41
#include
#include

void handler(int signo)
{
    printf(\"Into handler\\n\");
    while(1);
}
int main()
{
    struct sigaction act;
          


        
5条回答
  •  囚心锁ツ
    2021-01-11 11:02

    You need to set SA_NODEFER on sa_mask to catch the same signal as the one you're currently handling:

    SA_NODEFER: Do not prevent the signal from being received from within its own signal handler. SA_NOMASK is an obsolete, non-standard synonym for this flag.

提交回复
热议问题