Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
struct sigaction act; memset(&act,0,sizeof act); sigaction(SIGALRM, &act, NULL); alarm(any_seconds);
我在linux中的报警代码。
我遇到了“闹钟”消息。但我不想看到这个消息。
我能怎么做?请帮忙。
你可以捕捉到信号
static void alarmHandler(int signo) { (void)signo; printf("Another message\n"); // or skip this line } ... alarm(any_seconds); signal(SIGALRM, alarmHandler);