diff options
Diffstat (limited to 'src/helpers/Watchdog.cpp')
| -rw-r--r-- | src/helpers/Watchdog.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/helpers/Watchdog.cpp b/src/helpers/Watchdog.cpp index c7ff648b..b919bbc7 100644 --- a/src/helpers/Watchdog.cpp +++ b/src/helpers/Watchdog.cpp @@ -1,5 +1,5 @@ #include "Watchdog.hpp" -#include <signal.h> +#include <csignal> #include "config/ConfigManager.hpp" #include "../config/ConfigValue.hpp" @@ -12,8 +12,7 @@ CWatchdog::~CWatchdog() { m_pWatchdog->join(); } -CWatchdog::CWatchdog() { - m_iMainThreadPID = pthread_self(); +CWatchdog::CWatchdog() : m_iMainThreadPID(pthread_self()) { m_pWatchdog = std::make_unique<std::thread>([this] { static auto PTIMEOUT = CConfigValue<Hyprlang::INT>("debug:watchdog_timeout"); @@ -24,7 +23,7 @@ CWatchdog::CWatchdog() { 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; }) == false) + 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) |
