]> git.stg.codes - stg.git/blobdiff - projects/stargazer/eventloop.cpp
Block all signals in threads other than main
[stg.git] / projects / stargazer / eventloop.cpp
index 4cd6074bcbdabdd6618f83ac59ad5b988cb2c42b..6cc59c94bde7d039c225e976d13adfbdf99181f1 100644 (file)
@@ -1,12 +1,18 @@
+#include <csignal>
 #include <cerrno>
 #include <cstring>
 
+#include "stg/locker.h"
+#include "stg/common.h"
 #include "eventloop.h"
-#include "stg_locker.h"
-#include "common.h"
 
 EVENT_LOOP::EVENT_LOOP()
-    : ACTIONS_LIST()
+    : ACTIONS_LIST(),
+      _running(false),
+      _stopped(true),
+      _tid(),
+      _mutex(),
+      _condition()
 {
 pthread_mutex_init(&_mutex, NULL);
 pthread_cond_init(&_condition, NULL);
@@ -48,6 +54,10 @@ return NULL;
 
 void EVENT_LOOP::Runner()
 {
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
 _stopped = false;
 printfd(__FILE__, "EVENT_LOOP::Runner - Before start\n");
 while (_running)