From fe9c61fe73b82cd230c180659275a581e3da292c Mon Sep 17 00:00:00 2001 From: Eladash Date: Sat, 12 Sep 2020 18:28:00 +0300 Subject: [PATCH] atomic.hpp: Fix atomic_storage_futex::raw_notify --- Utilities/Thread.h | 5 +++-- rpcs3/util/atomic.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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;