mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 12:42:41 +01:00
sys_ppu_thread: Optimize joined thread notification
This commit is contained in:
parent
d5eebd6ab4
commit
52575a44b2
@ -201,10 +201,6 @@ error_code sys_ppu_thread_join(ppu_thread& ppu, u32 thread_id, vm::ptr<u64> 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<u64> 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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user