mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 16:14:35 +02:00
rename to standard
This commit is contained in:
parent
4a26785eda
commit
c27dd446eb
1 changed files with 11 additions and 11 deletions
|
@ -90,29 +90,29 @@ public:
|
||||||
CheckDevicesThread(AudioClient* client) : BackgroundThread(client) {}
|
CheckDevicesThread(AudioClient* client) : BackgroundThread(client) {}
|
||||||
|
|
||||||
void join() override {
|
void join() override {
|
||||||
_quit = true;
|
_shouldQuit = true;
|
||||||
std::unique_lock<std::mutex> lock(mutex);
|
std::unique_lock<std::mutex> lock(_joinMutex);
|
||||||
cv.wait(lock, [&]{ return !running; });
|
_joinCondition.wait(lock, [&]{ return !_isRunning; });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run() override {
|
void run() override {
|
||||||
while (!_quit) {
|
while (!_shouldQuit) {
|
||||||
_client->checkDevices();
|
_client->checkDevices();
|
||||||
|
|
||||||
const unsigned long DEVICE_CHECK_INTERVAL_MSECS = 2 * 1000;
|
const unsigned long DEVICE_CHECK_INTERVAL_MSECS = 2 * 1000;
|
||||||
QThread::msleep(DEVICE_CHECK_INTERVAL_MSECS);
|
QThread::msleep(DEVICE_CHECK_INTERVAL_MSECS);
|
||||||
}
|
}
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::mutex> lock(_joinCondition);
|
||||||
running = false;
|
_isRunning = false;
|
||||||
cv.notify_one();
|
_joinCondition.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::atomic<bool> _quit { false };
|
std::atomic<bool> _shouldQuit { false };
|
||||||
bool running { true };
|
bool _isRunning { true };
|
||||||
std::mutex mutex;
|
std::mutex _joinMutex;
|
||||||
std::condition_variable cv;
|
std::condition_variable _joinCondition;
|
||||||
};
|
};
|
||||||
|
|
||||||
// background thread buffering local injectors
|
// background thread buffering local injectors
|
||||||
|
|
Loading…
Reference in a new issue