#include #include #include #include #include #include #include #include static volatile bool stop; static void alarm_handler(int sig) { printf("Woof woof!\n"); stop = true; } int main(void) { struct sched_param sp; int ret; memset(&sp, 0, sizeof(sp)); sp.sched_priority = 12; ret = sched_setscheduler(0, SCHED_FIFO, &sp); if (ret != 0) { printf("Error setting scheduler\n"); return -1; } if (signal(SIGALRM, alarm_handler) == SIG_ERR) { printf("\ncan't catch SIGINT\n"); return -1; } alarm(5); while (!stop) {} return 0; }