* 'queue_lock' of https://github.com/MaxKellermann/zeek:
  threading/Queue: lock mutex before notifying the condition_variable
This commit is contained in:
Jon Siwek 2020-02-28 11:36:12 -08:00
commit 30a794cf5f
3 changed files with 10 additions and 1 deletions

View file

@ -1,4 +1,10 @@
3.2.0-dev.192 | 2020-02-28 11:36:12 -0800
* threading::Queue::WakeUp(): lock mutex before notifying condition_variable (Max Kellermann)
Not locking the associated mutex can create race conditions and lockups.
3.2.0-dev.190 | 2020-02-28 00:42:17 -0800
* Stmt: use class IntrusivePtr (Max Kellermann)

View file

@ -1 +1 @@
3.2.0-dev.190
3.2.0-dev.192

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();
}
}
}