0
struct sigaction act;
memset(&act,0,sizeof act);
sigaction(SIGALRM, &act, NULL);
alarm(any_seconds);

我在linux中的报警代码。

我遇到了“闹钟”消息。但我不想看到这个消息。

我能怎么做?请帮忙。

4

1 回答 1

0

你可以捕捉到信号

static void alarmHandler(int signo)
{
    (void)signo;
    printf("Another message\n"); // or skip this line
}

...
alarm(any_seconds);
signal(SIGALRM, alarmHandler);
于 2020-04-19T17:43:01.047 回答