sys_ppu_thread: Optimize joined thread notification
This commit is contained in:
@@ -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::prepare_for_sleep(ppu);
|
||||||
lv2_obj::sleep(ppu);
|
lv2_obj::sleep(ppu);
|
||||||
}
|
}
|
||||||
else if (result == CELL_EAGAIN)
|
|
||||||
{
|
|
||||||
thread.joiner.notify_one();
|
|
||||||
}
|
|
||||||
|
|
||||||
notify.cleanup();
|
notify.cleanup();
|
||||||
return result;
|
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;
|
return thread.ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (thread.ret == CELL_EAGAIN)
|
||||||
|
{
|
||||||
|
// Notify thread if waiting for a joiner
|
||||||
|
thread->joiner.notify_one();
|
||||||
|
}
|
||||||
|
|
||||||
// Wait for cleanup
|
// Wait for cleanup
|
||||||
(*thread.ptr)();
|
(*thread.ptr)();
|
||||||
|
|
||||||
@@ -287,11 +289,6 @@ error_code sys_ppu_thread_detach(ppu_thread& ppu, u32 thread_id)
|
|||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result == CELL_EAGAIN)
|
|
||||||
{
|
|
||||||
thread.joiner.notify_one();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove ID on EAGAIN
|
// Remove ID on EAGAIN
|
||||||
return result != CELL_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)
|
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;
|
*ptr = thread_state::finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user