Commit 48c9d699 authored by Aang23's avatar Aang23

Proper SIGINT handler

parent 188b1d61
Pipeline #287 passed with stage
in 2 minutes and 49 seconds
# AltiWx
*Yet another automated SDR-based station software*
## Why
TODO
\ No newline at end of file
#include "logger/logger.h"
#include <csignal>
#include "orbit/orbit_predictor.h"
#include "orbit/tle_manager.h"
#include "config/config.h"
......@@ -15,6 +16,14 @@
#include "database/database.h"
#include "web/server.h"
bool shouldExit = false;
void signalHandler(int signum)
{
logger->critical("Exiting!!!!");
shouldExit = true;
}
int main(int argc, char *argv[])
{
// Start logger first
......@@ -62,7 +71,12 @@ int main(int argc, char *argv[])
//std::thread test([=] { processPass({21576, getTLEFromNORAD(21576), time(NULL), time(NULL) + 20, 10.0f, false, true}); });
//processPass({40069, getTLEFromNORAD(40069), time(NULL), time(NULL) + 20, 10.0f, false, true});
std::cin.get();
// Register our custom shutdown signal
signal(SIGINT, signalHandler);
// And wait
while (!shouldExit)
std::this_thread::sleep_for(std::chrono::seconds(1));
// Stop communication manager
communicationManager.stop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment