From b64b98490e53eb24a6adf441444d6b17b9ce8bd3 Mon Sep 17 00:00:00 2001 From: Eladash <18193363+elad335@users.noreply.github.com> Date: Wed, 6 Mar 2024 14:57:42 +0200 Subject: [PATCH] init_mutex.hpp: Fixup --- rpcs3/util/init_mutex.hpp | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/rpcs3/util/init_mutex.hpp b/rpcs3/util/init_mutex.hpp index 19ff2aedb7..04355b276d 100644 --- a/rpcs3/util/init_mutex.hpp +++ b/rpcs3/util/init_mutex.hpp @@ -58,20 +58,14 @@ namespace stx if (val == 0) { // Success: obtained "init lock" - - if constexpr (sizeof...(FAndArgs)) - { - if (invoked_func) - { - invoke_callback(1, std::forward(args)...); - } - } - break; } if (val & c_init_bit) { + // Failure + _this = nullptr; + if constexpr (Forced()()) { // Forced reset @@ -83,19 +77,6 @@ namespace stx _this->m_state.wait(val); val = _this->m_state; } - - break; - } - - // Failure - _this = nullptr; - - if constexpr (sizeof...(FAndArgs)) - { - if (invoked_func) - { - invoke_callback(1, std::forward(args)...); - } } break; @@ -112,6 +93,15 @@ namespace stx _this->m_state.wait(val); } + + // Finalization of wait callback + if constexpr (sizeof...(FAndArgs)) + { + if (invoked_func) + { + invoke_callback(1, std::forward(args)...); + } + } } init_lock(const init_lock&) = delete;