From 981538aa2a7f53622ee4bcbf1e513468e4edb4d7 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Thu, 30 Sep 2021 19:14:17 -0700 Subject: [PATCH] Base: Make some items atomic --- src/Config.h | 4 ++-- src/obs-websocket.cpp | 5 +++++ src/obs-websocket.h | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Config.h b/src/Config.h index 89aa838f..916162a5 100644 --- a/src/Config.h +++ b/src/Config.h @@ -19,8 +19,8 @@ class Config { bool FirstLoad; bool ServerEnabled; uint16_t ServerPort; - bool DebugEnabled; - bool AlertsEnabled; + std::atomic DebugEnabled; + std::atomic AlertsEnabled; bool AuthRequired; QString ServerPassword; diff --git a/src/obs-websocket.cpp b/src/obs-websocket.cpp index 1c636ce4..2241c028 100644 --- a/src/obs-websocket.cpp +++ b/src/obs-websocket.cpp @@ -102,3 +102,8 @@ os_cpu_usage_info_t* GetCpuUsageInfo() { return _cpuUsageInfo; } + +bool IsDebugMode() +{ + return !_config || _config->DebugEnabled; +} \ No newline at end of file diff --git a/src/obs-websocket.h b/src/obs-websocket.h index 5eb40916..13cf39f2 100644 --- a/src/obs-websocket.h +++ b/src/obs-websocket.h @@ -53,3 +53,5 @@ WebSocketServerPtr GetWebSocketServer(); EventHandlerPtr GetEventHandler(); os_cpu_usage_info_t* GetCpuUsageInfo(); + +bool IsDebugMode();