Setup the interrupt handler based on platform
| 429 | |
| 430 | // Setup the interrupt handler based on platform |
| 431 | void setup_interrupt_handler() { |
| 432 | #ifdef _WIN32 |
| 433 | if (!SetConsoleCtrlHandler(console_ctrl_handler, TRUE)) { |
| 434 | cerr << "ERROR: Could not set control handler" << endl; |
| 435 | } |
| 436 | #else |
| 437 | struct sigaction sa {}; |
| 438 | sigemptyset(&sa.sa_mask); |
| 439 | sa.sa_handler = signal_handler; |
| 440 | sigaction(SIGINT, &sa, NULL); |
| 441 | #endif |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | // Utility function to get file size |