From 1dedeb37bf23689c9ac38ba4a214440a0e94291e Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Wed, 5 Jun 2019 15:51:25 +0300 Subject: [PATCH] Fix lf_queue_base::wait Add missing state change --- Utilities/cond.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Utilities/cond.cpp b/Utilities/cond.cpp index 2e1a900a05..718ce5cb30 100644 --- a/Utilities/cond.cpp +++ b/Utilities/cond.cpp @@ -275,6 +275,14 @@ void shared_cond::imp_notify() noexcept bool lf_queue_base::wait(u64 _timeout) { + auto _old = m_head.compare_and_swap(0, 1); + + if (_old) + { + verify("lf_queue concurrent wait" HERE), _old != 1; + return true; + } + return balanced_wait_until(m_head, _timeout, [](std::uintptr_t& head, auto... ret) -> int { if (head != 1)