mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-21 09:29:11 +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();
|
_heartbeat = usecTimestampNow();
|
||||||
});
|
});
|
||||||
heartbeatTimer->start(HEARTBEAT_UPDATE_INTERVAL_SECS * MSECS_PER_SECOND);
|
heartbeatTimer->start(HEARTBEAT_UPDATE_INTERVAL_SECS * MSECS_PER_SECOND);
|
||||||
|
connect(qApp, &QCoreApplication::aboutToQuit, [this] {
|
||||||
|
_quit = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void deadlockDetectionCrash() {
|
void deadlockDetectionCrash() {
|
||||||
|
@ -258,7 +261,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void run() override {
|
void run() override {
|
||||||
while (!qApp->isAboutToQuit()) {
|
while (!_quit) {
|
||||||
QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS);
|
QThread::sleep(HEARTBEAT_UPDATE_INTERVAL_SECS);
|
||||||
auto now = usecTimestampNow();
|
auto now = usecTimestampNow();
|
||||||
auto lastHeartbeatAge = now - _heartbeat;
|
auto lastHeartbeatAge = now - _heartbeat;
|
||||||
|
@ -269,6 +272,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::atomic<uint64_t> _heartbeat;
|
static std::atomic<uint64_t> _heartbeat;
|
||||||
|
bool _quit { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
std::atomic<uint64_t> DeadlockWatchdogThread::_heartbeat;
|
std::atomic<uint64_t> DeadlockWatchdogThread::_heartbeat;
|
||||||
|
|
Loading…
Reference in a new issue