| 17 | } |
| 18 | |
| 19 | static void CatchSignals(void) |
| 20 | { |
| 21 | #ifdef _WIN32 |
| 22 | signal(SIGINT, s_signal_handler); |
| 23 | signal(SIGTERM, s_signal_handler); |
| 24 | #else |
| 25 | struct sigaction action; |
| 26 | action.sa_handler = s_signal_handler; |
| 27 | action.sa_flags = 0; |
| 28 | sigemptyset(&action.sa_mask); |
| 29 | sigaction(SIGINT, &action, nullptr); |
| 30 | sigaction(SIGTERM, &action, nullptr); |
| 31 | #endif |
| 32 | } |
| 33 | |
| 34 | int main(int argc, char* argv[]) |
| 35 | { |