diff --git a/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp b/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp index 9d22591d48..5ec98c54ff 100644 --- a/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp @@ -146,13 +146,13 @@ error_code sys_ppu_thread_join(ppu_thread& ppu, u32 thread_id, vm::ptr vptr sys_ppu_thread.trace("sys_ppu_thread_join(thread_id=0x%x, vptr=*0x%x)", thread_id, vptr); + if (thread_id == ppu.id) + { + return CELL_EDEADLK; + } + auto thread = idm::get>(thread_id, [&, notify = lv2_obj::notify_all_t()](ppu_thread& thread) -> CellError { - if (&ppu == &thread) - { - return CELL_EDEADLK; - } - CellError result = thread.joiner.atomic_op([&](ppu_join_status& value) -> CellError { if (value == ppu_join_status::zombie) @@ -307,7 +307,18 @@ error_code sys_ppu_thread_set_priority(ppu_thread& ppu, u32 thread_id, s32 prio) return CELL_EINVAL; } - const auto thread = idm::check>(thread_id, [&](ppu_thread& thread) + if (thread_id == ppu.id) + { + // Fast path for self + if (ppu.prio != prio) + { + lv2_obj::set_priority(ppu, prio); + } + + return CELL_OK; + } + + const auto thread = idm::check>(thread_id, [&, notify = lv2_obj::notify_all_t()](ppu_thread& thread) { if (thread.prio != prio) { @@ -329,7 +340,15 @@ error_code sys_ppu_thread_get_priority(ppu_thread& ppu, u32 thread_id, vm::ptr>(thread_id, [&](ppu_thread& thread) { @@ -341,6 +360,7 @@ error_code sys_ppu_thread_get_priority(ppu_thread& ppu, u32 thread_id, vm::ptr