Second signal call in sighandler - what for?

后端 未结 3 448
温柔的废话
温柔的废话 2021-01-22 02:47

Recently I found some code which uses signal:

  286 static void sighandler( int signum )
  287 {   
  288     alarmed = 1;
  289     signal( signum,         


        
3条回答
  •  醉梦人生
    2021-01-22 02:59

    There are systems where, if signal() is called with a function, the signal handler is reset to default after the first signal is caught (I haven't found out on the fly if it's defined to be so). That's the reason why signal() is called again in the signal handler.

提交回复
热议问题