diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index af195ed770..53fc8ddb06 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -952,7 +952,7 @@ bool cpu_thread::check_state() noexcept continue; } - if (state0 & cpu_flag::yield && cpu_flag::wait - state0 && cpu_can_stop) + if (state0 & cpu_flag::yield && cpu_can_stop) { if (auto spu = try_get()) { diff --git a/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/Emu/Cell/lv2/lv2.cpp index e82efc1c88..f8db392ef6 100644 --- a/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -1763,9 +1763,13 @@ void lv2_obj::schedule_all(u64 current_time) if (target->state & cpu_flag::suspend) { ppu_log.trace("schedule(): %s", target->id); + + // Remove yield if it was sleeping until now + const bs_t remove_yield = target->start_time == 0 ? +cpu_flag::suspend : (cpu_flag::yield + cpu_flag::preempt); + target->start_time = 0; - if ((target->state.fetch_op(FN(x += cpu_flag::signal, x -= cpu_flag::suspend, void())) & (cpu_flag::wait + cpu_flag::signal)) != cpu_flag::wait) + if ((target->state.fetch_op(FN(x += cpu_flag::signal, x -= cpu_flag::suspend, x-= remove_yield, void())) & (cpu_flag::wait + cpu_flag::signal)) != cpu_flag::wait) { continue; }