mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-07 19:05:58 +01:00
watchdog: don't hang on exit
This commit is contained in:
parent
e07e64458e
commit
4daa515700
2 changed files with 8 additions and 1 deletions
|
@ -3,6 +3,9 @@
|
|||
#include "config/ConfigManager.hpp"
|
||||
|
||||
CWatchdog::~CWatchdog() {
|
||||
m_bExitThread = true;
|
||||
m_bNotified = true;
|
||||
m_cvWatchdogCondition.notify_all();
|
||||
m_pWatchdog.reset();
|
||||
}
|
||||
|
||||
|
@ -22,6 +25,9 @@ CWatchdog::CWatchdog() {
|
|||
pthread_kill(m_iMainThreadPID, SIGUSR1);
|
||||
}
|
||||
|
||||
if (m_bExitThread)
|
||||
break;
|
||||
|
||||
m_bWatching = false;
|
||||
m_bNotified = false;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ class CWatchdog {
|
|||
std::unique_ptr<std::thread> m_pWatchdog;
|
||||
std::mutex m_mWatchdogMutex;
|
||||
bool m_bNotified = false;
|
||||
bool m_bExitThread = false;
|
||||
std::condition_variable m_cvWatchdogCondition;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue