rename to standard

This commit is contained in:
Zach Pomerantz 2017-04-25 14:59:30 -04:00
parent 4a26785eda
commit c27dd446eb

View file

@ -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