threading/Queue: lock mutex before notifying the condition_variable

Locking the associated mutex is not strictly mandatory, but not doing
so can easily create race conditions and lockups.
This commit is contained in:
Max Kellermann 2020-01-26 18:55:40 +01:00
parent 2a7f2e0217
commit 0605ba2824

View file

@ -255,7 +255,10 @@ template<typename T>
inline void Queue<T>::WakeUp()
{
for ( int i = 0; i < NUM_QUEUES; i++ )
{
auto lock = acquire_lock(mutex[i]);
has_data[i].notify_all();
}
}
}