33 lines
No EOL
540 B
C
33 lines
No EOL
540 B
C
/*
|
|
* @Author: 1ridic
|
|
* @Date: 2022-09-18 14:13:59
|
|
* @Last Modified by: 1ridic
|
|
* @Last Modified time: 2022-09-18 14:21:48
|
|
*/
|
|
#include <signal.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include "loop.h"
|
|
|
|
char volatile isWaiting = 0;
|
|
void intHandler(int dummy) {
|
|
if (isWaiting) {
|
|
return;
|
|
printf("\nSIGINT exit.\n");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
signal(SIGINT, intHandler);
|
|
|
|
#ifdef DEBUG
|
|
printf("DEBUG is defined\n");
|
|
#endif
|
|
while (1) {
|
|
loop();
|
|
}
|
|
return 0;
|
|
} |