From 1ee365e7b462128b03e197b01f546edc0c757973 Mon Sep 17 00:00:00 2001 From: "Alexander Kutsan (GitHub)" Date: Thu, 3 Sep 2020 22:21:18 +0300 Subject: SDLCORE-459 : Fix trying to unlock mutex not held by any thread (#3380) SDLCORE-459 Helgrind considers that this issue is an error because we release mutex before call Broadcast. Co-authored-by: Elvis Kuliiev --- src/components/include/utils/message_queue.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/include/utils/message_queue.h b/src/components/include/utils/message_queue.h index 8dfe7afa52..fd7b762a48 100644 --- a/src/components/include/utils/message_queue.h +++ b/src/components/include/utils/message_queue.h @@ -171,13 +171,11 @@ bool MessageQueue::IsShuttingDown() const { template void MessageQueue::push(const T& element) { - { - sync_primitives::AutoLock auto_lock(queue_lock_); - if (shutting_down_) { - return; - } - queue_.push(element); + sync_primitives::AutoLock auto_lock(queue_lock_); + if (shutting_down_) { + return; } + queue_.push(element); queue_new_items_.Broadcast(); } -- cgit v1.2.1