Fix sys_ppu_thread_start error checking, fix rare bug in sys_ppu_thread_create

* Correct error code to EBUSY.
* lv2_obj::awake was called even when EBSUY should be returned.
* Fix sys_ppu_thread_create for a newly created thread with the same id as ppu_thread::id_base. (can happen if main thread exited before its creation)
This commit is contained in:
Eladash 2020-04-29 08:03:07 +03:00
parent c1dc6838fa
commit dd6825a7bd
3 changed files with 23 additions and 15 deletions

View file

@ -788,14 +788,11 @@ ppu_thread::ppu_thread(const ppu_thread_params& param, std::string_view name, u3
gpr[13] = param.tls_addr;
if (detached >= 0 && id != id_base)
if (detached >= 0)
{
// Initialize thread entry point
cmd_list
({
{ppu_cmd::set_args, 2}, param.arg0, param.arg1,
{ppu_cmd::opd_call, 0}, std::bit_cast<u64>(entry_func),
});
// Initialize thread args
gpr[3] = param.arg0;
gpr[4] = param.arg1;
}
// Trigger the scheduler