mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 22:39:18 +02:00
lock around quit flag to avoid shutdown race
This commit is contained in:
parent
a49669a975
commit
ae17135a07
1 changed files with 10 additions and 2 deletions
|
@ -85,18 +85,26 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void beforeAboutToQuit() {
|
void beforeAboutToQuit() {
|
||||||
|
Lock lock(_checkDevicesMutex);
|
||||||
_quit = true;
|
_quit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void run() override {
|
void run() override {
|
||||||
while (!_quit) {
|
for (;;) {
|
||||||
|
{
|
||||||
|
Lock lock(_checkDevicesMutex);
|
||||||
|
if (_quit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_audioClient->checkDevices();
|
||||||
|
}
|
||||||
QThread::msleep(DEVICE_CHECK_INTERVAL_MSECS);
|
QThread::msleep(DEVICE_CHECK_INTERVAL_MSECS);
|
||||||
_audioClient->checkDevices();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AudioClient* _audioClient { nullptr };
|
AudioClient* _audioClient { nullptr };
|
||||||
|
Mutex _checkDevicesMutex;
|
||||||
bool _quit { false };
|
bool _quit { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue