lock around quit flag to avoid shutdown race

This commit is contained in:
Seth Alves 2016-11-01 11:14:16 -07:00
parent a49669a975
commit ae17135a07

View file

@ -85,18 +85,26 @@ public:
}
void beforeAboutToQuit() {
Lock lock(_checkDevicesMutex);
_quit = true;
}
void run() override {
while (!_quit) {
for (;;) {
{
Lock lock(_checkDevicesMutex);
if (_quit) {
break;
}
_audioClient->checkDevices();
}
QThread::msleep(DEVICE_CHECK_INTERVAL_MSECS);
_audioClient->checkDevices();
}
}
private:
AudioClient* _audioClient { nullptr };
Mutex _checkDevicesMutex;
bool _quit { false };
};