#include <Core/Core.h> #include <signal.h> using namespace Upp; static std::atomic<bool> done(false); static void SecureStop(int) { done = true; } CONSOLE_APP_MAIN { String s; struct sigaction sa; Zero(sa); sa.sa_handler = &SecureStop; sigaction(SIGINT, &sa, nullptr); while(s != "exit" && !done) { s = ReadStdIn(); } if(done) { Cout() << "SIGINT!" << "\n"; } }
Report message to a moderator