SIGINT SIGTERM

This commit is contained in:
ackimixs
2024-05-08 11:16:57 +02:00
parent c2a109463b
commit e746adc685

View File

@@ -5,9 +5,19 @@
#include <thread>
#include <atomic>
#include <optional>
#include <csignal>
std::atomic<bool> shouldStop = false;
void signalHandler( int signum ) {
shouldStop = true;
}
int main(int argc, char *argv[])
{
signal(SIGINT, signalHandler);
signal(SIGTERM, signalHandler);
// Settup argument parser
bool headless = false;
@@ -101,7 +111,7 @@ int main(int argc, char *argv[])
}
}
if (client.shouldStop() || stopRequested)
if (client.shouldStop() || stopRequested || shouldStop)
{
break;
}