From 8e4659a6cbe08c5fccabf05fda6ace11dc214574 Mon Sep 17 00:00:00 2001 From: Antonino Di Guardo <64427768+digant73@users.noreply.github.com> Date: Tue, 6 Oct 2026 17:59:20 +0200 Subject: [PATCH] LV2: Fix sys_ppu_thread_start gate freezing PPU threads (#19707) --- rpcs3/Emu/Cell/PPUThread.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index fcd17f53a0..6794294f5b 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -2547,9 +2547,10 @@ void ppu_thread::cpu_task() { // The caller of sys_ppu_thread_start has higher or equal priority and waits for the exchange above: // let it leave the syscall and run its first instructions before this thread starts + // Bounded, as it may enter another syscall right away (e.g. joining this thread), and ended on suspension, which cannot be acknowledged here if (const auto caller = idm::get_unlocked>(caller_id)) { - while (!is_stopped()) + for (const u64 wait_start = get_system_time(); !is_stopped() && cpu_flag::suspend - state && get_system_time() - wait_start < 1000;) { const auto caller_state = +caller->state; @@ -2564,7 +2565,7 @@ void ppu_thread::cpu_task() { constexpr u64 caller_head_start_us = 10; - for (const u64 start = get_system_time(); !is_stopped() && get_system_time() - start < caller_head_start_us;) + for (const u64 start = get_system_time(); !is_stopped() && cpu_flag::suspend - state && get_system_time() - start < caller_head_start_us;) { std::this_thread::yield(); }