mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-07-31 20:21:54 -07:00
watchdog: don't hang on exit
This commit is contained in:
@@ -3,6 +3,9 @@
|
|||||||
#include "config/ConfigManager.hpp"
|
#include "config/ConfigManager.hpp"
|
||||||
|
|
||||||
CWatchdog::~CWatchdog() {
|
CWatchdog::~CWatchdog() {
|
||||||
|
m_bExitThread = true;
|
||||||
|
m_bNotified = true;
|
||||||
|
m_cvWatchdogCondition.notify_all();
|
||||||
m_pWatchdog.reset();
|
m_pWatchdog.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,6 +25,9 @@ CWatchdog::CWatchdog() {
|
|||||||
pthread_kill(m_iMainThreadPID, SIGUSR1);
|
pthread_kill(m_iMainThreadPID, SIGUSR1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_bExitThread)
|
||||||
|
break;
|
||||||
|
|
||||||
m_bWatching = false;
|
m_bWatching = false;
|
||||||
m_bNotified = false;
|
m_bNotified = false;
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,8 @@ class CWatchdog {
|
|||||||
|
|
||||||
std::unique_ptr<std::thread> m_pWatchdog;
|
std::unique_ptr<std::thread> m_pWatchdog;
|
||||||
std::mutex m_mWatchdogMutex;
|
std::mutex m_mWatchdogMutex;
|
||||||
bool m_bNotified = false;
|
bool m_bNotified = false;
|
||||||
|
bool m_bExitThread = false;
|
||||||
std::condition_variable m_cvWatchdogCondition;
|
std::condition_variable m_cvWatchdogCondition;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user