aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rw-r--r--data/client.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/data/client.cpp b/data/client.cpp
index 74f2bc5..f0ffa6a 100644
--- a/data/client.cpp
+++ b/data/client.cpp
@@ -5,6 +5,7 @@
#include <implot.h>
#include <limits.h>
#include <math.h>
+#include <signal.h>
#include <initializer_list>
@@ -368,6 +369,13 @@ void gui_print(void) {
// ----------------------------------------------------------------------------
// Main functions
// ----------------------------------------------------------------------------
+void sig_handler(int signo) {
+ (void)signo;
+
+ log_warn("Signal received, will stop SALIS data client...");
+ glfwSetWindowShouldClose(g_window, GLFW_TRUE);
+}
+
void glfw_error_callback(int error, const char* description) {
log_warn("GLFW error %d: %s", error, description);
}
@@ -454,6 +462,9 @@ int main(int argc, char **argv) {
(void)argc;
(void)argv;
+ signal(SIGINT, sig_handler);
+ signal(SIGTERM, sig_handler);
+
log_info("Starting SALIS data client");
log_info("Initializing GLFW");