Use sigaction to install signal handlers in bindings provider

Also small cleanup of includes
This commit is contained in:
Sapphire committed 2026-12-06 05:45:30 -05:00
1 parent 64261eee6e
commit 0ebf7be578
1 file changed
+8 -5
+8 -5
View File
@@ -5,8 +5,7 @@
#include <tuple>
// These must be included before Windows.h because of some macro collisions.
#include "flatbuffers/flatbuffers.h"
#include "solarxr_protocol/generated/all_generated.h"
#include <solarxr_protocol/generated/all_generated.h>
#include "bridge/BridgeClient.hpp"
#include "logger.hpp"
@@ -19,7 +18,7 @@
#define NOMINMAX
#include <Windows.h>
#else
#include <cstdlib>
#include <signal.h>
#endif
namespace fs = std::filesystem;
@@ -216,8 +215,12 @@ int main() {
constexpr auto interval = 1000ms / 30;
signal(SIGINT, OnSignal);
signal(SIGTERM, OnSignal);
// Install signal handlers.
struct sigaction action{};
action.sa_handler = OnSignal;
sigaction(SIGINT, &action, nullptr);
sigaction(SIGTERM, &action, nullptr);
while (!should_exit) {
vr::VREvent_t event{};
while (sys->PollNextEvent(&event, sizeof(event))) {