From 9828e6cafc0ec8a058e81f40a33647030d6cdc88 Mon Sep 17 00:00:00 2001 From: Eladash Date: Fri, 28 Apr 2023 19:19:51 +0300 Subject: [PATCH] LV2: Push other-than-this thread to the back on priority set --- rpcs3/Emu/Cell/lv2/lv2.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/Emu/Cell/lv2/lv2.cpp index 01d6192c87..ad5a93acd2 100644 --- a/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -1429,7 +1429,15 @@ bool lv2_obj::awake_unlocked(cpu_thread* cpu, s32 prio) default: { // Priority set - if (static_cast(cpu)->prio.exchange(prio) == prio || !unqueue(g_ppu, static_cast(cpu), &ppu_thread::next_ppu)) + const s32 old_prio = static_cast(cpu)->prio.exchange(prio); + + // If priority is the same, push ONPROC/RUNNABLE thread to the back of the priority list if it is not the current thread + if (old_prio == prio && cpu == cpu_thread::get_current()) + { + return true; + } + + if (!unqueue(g_ppu, static_cast(cpu), &ppu_thread::next_ppu)) { return true; }