Fix race condition in the control plugin

This commit is contained in:
Alexey Rybalchenko 2018-09-12 12:29:51 +02:00 committed by Mohammad Al-Turany
parent 6f7ffeef13
commit 2c6b2e7f04

View File

@ -229,7 +229,7 @@ auto Control::WaitForNextState() -> DeviceState
unique_lock<mutex> lock{fEventsMutex}; unique_lock<mutex> lock{fEventsMutex};
while (fEvents.empty()) while (fEvents.empty())
{ {
fNewEvent.wait(lock); fNewEvent.wait_for(lock, chrono::milliseconds(50));
} }
auto result = fEvents.front(); auto result = fEvents.front();