【发布时间】:2011-01-26 00:05:49
【问题描述】:
#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..
【问题讨论】:
标签: c unix posix signals sigint