mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-10 20:47:02 +02:00
Safer shutdown code in deadlock thread
This commit is contained in:
parent
b2be54a179
commit
cac31761c0
1 changed files with 5 additions and 1 deletions
|
@ -250,6 +250,9 @@ public:
|
|||
_heartbeat = usecTimestampNow();
|
||||
});
|
||||
heartbeatTimer->start(HEARTBEAT_UPDATE_INTERVAL_SECS * MSECS_PER_SECOND);
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, [this] {
|
||||
_quit = true;
|
||||
});
|
||||
}
|
||||
|
||||
void deadlockDetectionCrash() {
|
||||
|
@ -258,7 +261,7 @@ public:
|
|||
}
|
||||
|
||||
void run() override {
|
||||
while (!qApp->isAboutToQuit()) {
|
||||
while (!_quit) {
|
||||
QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS);
|
||||
auto now = usecTimestampNow();
|
||||
auto lastHeartbeatAge = now - _heartbeat;
|
||||
|
@ -269,6 +272,7 @@ public:
|
|||
}
|
||||
|
||||
static std::atomic<uint64_t> _heartbeat;
|
||||
bool _quit { false };
|
||||
};
|
||||
|
||||
std::atomic<uint64_t> DeadlockWatchdogThread::_heartbeat;
|
||||
|
|
Loading…
Reference in a new issue