#include #include #include #include void sigint_handler(int signo) { if (signo == SIGINT) { printf("received SIGINT, aborting abruptly\n"); abort(); } } int main() { signal(SIGINT, sigint_handler); while (true) { std::cout << "Loop..." << std::endl; std::this_thread::sleep_for(std::chrono::milliseconds(500)); } }