From 4512c10ce5e0e77c5a0db9c87803708a79563940 Mon Sep 17 00:00:00 2001 From: Eladash <18193363+elad335@users.noreply.github.com> Date: Wed, 6 Mar 2024 19:27:58 +0200 Subject: [PATCH] init_mutex.hpp: More fixes --- rpcs3/util/init_mutex.hpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/rpcs3/util/init_mutex.hpp b/rpcs3/util/init_mutex.hpp index 04355b276d..748554b627 100644 --- a/rpcs3/util/init_mutex.hpp +++ b/rpcs3/util/init_mutex.hpp @@ -63,9 +63,6 @@ namespace stx if (val & c_init_bit) { - // Failure - _this = nullptr; - if constexpr (Forced()()) { // Forced reset @@ -73,12 +70,23 @@ namespace stx while (val != 1) { + if constexpr (sizeof...(FAndArgs)) + { + if (!invoked_func) + { + invoke_callback(0, std::forward(args)...); + invoked_func = true; + } + } + // Wait for other users to finish their work _this->m_state.wait(val); val = _this->m_state; } } + // Failure + _this = nullptr; break; }