diff --git a/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp b/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp index 1ddd938a8d..822648ee53 100644 --- a/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp @@ -201,10 +201,6 @@ error_code sys_ppu_thread_join(ppu_thread& ppu, u32 thread_id, vm::ptr vptr lv2_obj::prepare_for_sleep(ppu); lv2_obj::sleep(ppu); } - else if (result == CELL_EAGAIN) - { - thread.joiner.notify_one(); - } notify.cleanup(); return result; @@ -220,6 +216,12 @@ error_code sys_ppu_thread_join(ppu_thread& ppu, u32 thread_id, vm::ptr vptr return thread.ret; } + if (thread.ret == CELL_EAGAIN) + { + // Notify thread if waiting for a joiner + thread->joiner.notify_one(); + } + // Wait for cleanup (*thread.ptr)(); @@ -287,11 +289,6 @@ error_code sys_ppu_thread_detach(ppu_thread& ppu, u32 thread_id) return {}; }); - if (result == CELL_EAGAIN) - { - thread.joiner.notify_one(); - } - // Remove ID on EAGAIN return result != CELL_EAGAIN; }); @@ -300,7 +297,7 @@ error_code sys_ppu_thread_detach(ppu_thread& ppu, u32 thread_id) { if (result == CELL_EAGAIN) { - // Join thread (it is detached from IDM now so it must be done explicitly now) + // Join and notify thread (it is detached from IDM now so it must be done explicitly now) *ptr = thread_state::finished; }