summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2025-04-09 01:48:21 +0100
committerVaxry <vaxry@vaxry.net>2025-04-09 01:48:21 +0100
commit4f991610d03609e4cfe06b4a1be694ce439b779b (patch)
treeebd75cf9eb4000ee775c8c9b08b110836918a4cd /src
parentea852965ffd4bf2bd2a74c0e821ba6190021eb31 (diff)
watchdog: remove watchdog
it has been unused for a while now
Diffstat (limited to 'src')
-rw-r--r--src/Compositor.cpp7
-rw-r--r--src/config/ConfigDescriptions.hpp6
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/helpers/Watchdog.cpp58
-rw-r--r--src/helpers/Watchdog.hpp34
5 files changed, 0 insertions, 106 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 947b6549..8e520237 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -59,7 +59,6 @@
#include "managers/ProtocolManager.hpp"
#include "managers/LayoutManager.hpp"
#include "plugins/PluginSystem.hpp"
-#include "helpers/Watchdog.hpp"
#include "hyprerror/HyprError.hpp"
#include "debug/HyprNotificationOverlay.hpp"
#include "debug/HyprDebugOverlay.hpp"
@@ -588,7 +587,6 @@ void CCompositor::cleanup() {
g_pConfigManager.reset();
g_pKeybindManager.reset();
g_pHookSystem.reset();
- g_pWatchdog.reset();
g_pXWaylandManager.reset();
g_pPointerManager.reset();
g_pSeatManager.reset();
@@ -642,11 +640,6 @@ void CCompositor::initManagers(eManagersInitStage stage) {
g_pTokenManager = makeUnique<CTokenManager>();
g_pConfigManager->init();
- g_pWatchdog = makeUnique<CWatchdog>(); // requires config
- // wait for watchdog to initialize to not hit data races in reading config values.
- while (!g_pWatchdog->m_bWatchdogInitialized) {
- std::this_thread::yield();
- }
Debug::log(LOG, "Creating the PointerManager!");
g_pPointerManager = makeUnique<CPointerManager>();
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp
index e7266940..49e5b7ae 100644
--- a/src/config/ConfigDescriptions.hpp
+++ b/src/config/ConfigDescriptions.hpp
@@ -1599,12 +1599,6 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.data = SConfigOptionDescription::SBoolData{false},
},
SConfigOptionDescription{
- .value = "debug:watchdog_timeout",
- .description = "sets the timeout in seconds for watchdog to abort processing of a signal of the main thread. Set to 0 to disable.",
- .type = CONFIG_OPTION_INT,
- .data = SConfigOptionDescription::SRangeData{5, 0, 20},
- },
- SConfigOptionDescription{
.value = "debug:disable_scale_checks",
.description = "disables verification of the scale factors. Will result in pixel alignment and rounding errors.",
.type = CONFIG_OPTION_BOOL,
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 6399372c..12e3cb5f 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -515,7 +515,6 @@ CConfigManager::CConfigManager() {
registerConfigVar("debug:suppress_errors", Hyprlang::INT{0});
registerConfigVar("debug:error_limit", Hyprlang::INT{5});
registerConfigVar("debug:error_position", Hyprlang::INT{0});
- registerConfigVar("debug:watchdog_timeout", Hyprlang::INT{5});
registerConfigVar("debug:disable_scale_checks", Hyprlang::INT{0});
registerConfigVar("debug:colored_stdout_logs", Hyprlang::INT{1});
registerConfigVar("debug:full_cm_proto", Hyprlang::INT{0});
diff --git a/src/helpers/Watchdog.cpp b/src/helpers/Watchdog.cpp
deleted file mode 100644
index 0956eed5..00000000
--- a/src/helpers/Watchdog.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "Watchdog.hpp"
-#include <csignal>
-#include "config/ConfigManager.hpp"
-#include "../config/ConfigValue.hpp"
-
-CWatchdog::~CWatchdog() {
- m_bExitThread = true;
- m_bNotified = true;
- m_cvWatchdogCondition.notify_all();
-
- if (m_pWatchdog && m_pWatchdog->joinable())
- m_pWatchdog->join();
-}
-
-CWatchdog::CWatchdog() : m_iMainThreadPID(pthread_self()) {
-
- m_pWatchdog = makeUnique<std::thread>([this] {
- static auto PTIMEOUT = CConfigValue<Hyprlang::INT>("debug:watchdog_timeout");
-
- m_bWatchdogInitialized = true;
- while (!m_bExitThread) {
- std::unique_lock<std::mutex> lk(m_mWatchdogMutex);
-
- if (!m_bWillWatch)
- m_cvWatchdogCondition.wait(lk, [this] { return m_bNotified || m_bExitThread; });
- else if (!m_cvWatchdogCondition.wait_for(lk, std::chrono::milliseconds((int)(*PTIMEOUT * 1000.0)), [this] { return m_bNotified || m_bExitThread; }))
- pthread_kill(m_iMainThreadPID, SIGUSR1);
-
- if (m_bExitThread)
- break;
-
- m_bWatching = false;
- m_bNotified = false;
- }
- });
-}
-
-void CWatchdog::startWatching() {
- static auto PTIMEOUT = CConfigValue<Hyprlang::INT>("debug:watchdog_timeout");
-
- if (*PTIMEOUT == 0)
- return;
-
- m_tTriggered = std::chrono::high_resolution_clock::now();
- m_bWillWatch = true;
- m_bWatching = true;
-
- m_bNotified = true;
- m_cvWatchdogCondition.notify_all();
-}
-
-void CWatchdog::endWatching() {
- m_bWatching = false;
- m_bWillWatch = false;
-
- m_bNotified = true;
- m_cvWatchdogCondition.notify_all();
-} \ No newline at end of file
diff --git a/src/helpers/Watchdog.hpp b/src/helpers/Watchdog.hpp
deleted file mode 100644
index 51b71d13..00000000
--- a/src/helpers/Watchdog.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#pragma once
-
-#include "memory/Memory.hpp"
-#include <chrono>
-#include <thread>
-#include <condition_variable>
-
-class CWatchdog {
- public:
- // must be called from the main thread
- CWatchdog();
- ~CWatchdog();
-
- void startWatching();
- void endWatching();
-
- std::atomic<bool> m_bWatchdogInitialized{false};
-
- private:
- std::chrono::high_resolution_clock::time_point m_tTriggered;
-
- pthread_t m_iMainThreadPID = 0;
-
- std::atomic<bool> m_bWatching = false;
- std::atomic<bool> m_bWillWatch = false;
-
- UP<std::thread> m_pWatchdog;
- std::mutex m_mWatchdogMutex;
- std::atomic<bool> m_bNotified = false;
- std::atomic<bool> m_bExitThread = false;
- std::condition_variable m_cvWatchdogCondition;
-};
-
-inline UP<CWatchdog> g_pWatchdog; \ No newline at end of file