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;