CS代考计算机代写 #include

#include
#include
#include

void alarm_handler(int signum)
{
printf(“
Beep, beep, beep!
”);
}

int main(void)
{
struct sigaction sa;
sigset_t ss;

/* Ignore Ctrl-C */
sigemptyset(&ss);
sigaddset(&ss, SIGINT);
sigprocmask(SIG_BLOCK, &ss, NULL);

/* Set up handler for alarm */
sa.sa_handler = alarm_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(SIGALRM, &sa, NULL);

/* Configure alarm */
printf(“Alarm in 5 seconds…
”);
alarm(5);

/* Wait until signal is received */
pause();

/* Bye, ungrateful world… */
raise(SIGKILL);

return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *