Примеры ошибок, обнаруженных с помощью диагностики V1089
V1089. Waiting on condition variable without predicate. A thread can wait indefinitely or experience a spurious wake-up.
GZDoom
V1089 Waiting on condition variable without predicate. A thread can wait indefinitely or experience a spurious wakeup. Consider passing a predicate as the second argument. oalsound.cpp 927
void OpenALSoundRenderer::BackgroundProc()
{
std::unique_lock<std::mutex> lock(StreamLock);
while (!QuitThread.load())
{
if (Streams.Size() == 0)
{
// If there's nothing to play, wait indefinitely.
StreamWake.wait(lock);
}
else
{
// Else, process all active streams and sleep for 100ms
for (size_t i = 0; i < Streams.Size(); i++)
Streams[i]->Process();
StreamWake.wait_for(lock, std::chrono::milliseconds(100));
}
}
}