summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kutsan (GitHub) <akutsan@luxoft.com>2020-09-03 22:21:18 +0300
committerGitHub <noreply@github.com>2020-09-03 15:21:18 -0400
commit1ee365e7b462128b03e197b01f546edc0c757973 (patch)
treebc9c45905efe4d90e7c7590c569af7aba028207b
parentc5e770bb37184b6d3564dda92863f6d2e17954d3 (diff)
downloadsdl_core-1ee365e7b462128b03e197b01f546edc0c757973.tar.gz
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 <ekuliiev@luxoft.com>
-rw-r--r--src/components/include/utils/message_queue.h10
1 files 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<T, Q>::IsShuttingDown() const {
template <typename T, class Q>
void MessageQueue<T, Q>::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();
}