diff --git a/Utilities/Thread.h b/Utilities/Thread.h index 8da60897bb..0a38703da3 100644 --- a/Utilities/Thread.h +++ b/Utilities/Thread.h @@ -314,13 +314,14 @@ class named_thread final : public Context, result_storage_t, thread_bas return false; } - _this->m_state_notifier.release(data); - if (!data) { + _this->m_state_notifier.release(data); return true; } + _this->m_state_notifier.store(data); + if (_this->m_state >= thread_state::aborting) { _this->m_state_notifier.release(nullptr); diff --git a/rpcs3/util/atomic.cpp b/rpcs3/util/atomic.cpp index b382d91254..4e856aa0b2 100644 --- a/rpcs3/util/atomic.cpp +++ b/rpcs3/util/atomic.cpp @@ -536,7 +536,7 @@ void atomic_storage_futex::wait(const void* data, std::size_t size, u64 old_valu bool fallback = false; - if (sema_id && ptr_cmp(data, size, old_value, mask) && s_tls_wait_cb(data)) + if (sema_id && s_tls_wait_cb(data) && ptr_cmp(data, size, old_value, mask)) { #ifdef USE_FUTEX struct timespec ts;