#include<stdio.h>
#include<signal.h>
void handler(int signo)
{
printf("Into handler\n");
while(1);
}
int main()
{
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(& act.sa_mask);
sigaction(SIGINT, &act, NULL);
while(1);
return 0;
}
捕获KeyboardInterrupt一次后,当我再次按 "Ctrl+C" 时,不处理 SIGINT ......我打算每次按 "Ctrl+C"时都应打印"Into handler " 。
我想在“SIGINT handler()”本身中捕获 SIGINT..