From ddec5d6908938d7509120b73d8e92f7598cd9e33 Mon Sep 17 00:00:00 2001 From: Eladash Date: Fri, 17 Sep 2021 12:01:29 +0300 Subject: [PATCH] CPUThread: Prevent recursive check_state calls --- rpcs3/Emu/CPU/CPUThread.cpp | 4 ++-- rpcs3/Emu/Cell/SPUThread.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 659f52fc7c..0ccc42a6e7 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -469,7 +469,7 @@ void cpu_thread::operator()() cpu_thread* _cpu = get_current_cpu_thread(); // Wait flag isn't set asynchronously so this should be thread-safe - if (progress == 0 && cpu_flag::wait - _cpu->state) + if (progress == 0 && _cpu->state.none_of(cpu_flag::wait + cpu_flag::temp)) { // Operation just started and syscall is imminent _cpu->state += cpu_flag::wait + cpu_flag::temp; @@ -739,7 +739,7 @@ bool cpu_thread::check_state() noexcept cpu_counter::add(this); } - if (state & cpu_flag::pending) + if ((state0 & (cpu_flag::pending + cpu_flag::temp)) == cpu_flag::pending) { // Execute pending work cpu_work(); diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index c61aa18173..14129e731d 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -3172,7 +3172,7 @@ bool spu_thread::process_mfc_cmd() mfc_last_timestamp = 0; // Process MFC commands - if (!test_stopped()) + if (test_stopped()) { return false; }