| 526 | } |
| 527 | |
| 528 | error_code sys_ppu_thread_start(ppu_thread &ppu, u32 thread_id) { |
| 529 | ppu.state += cpu_flag::wait; |
| 530 | |
| 531 | sys_ppu_thread.trace("sys_ppu_thread_start(thread_id=0x%x)", thread_id); |
| 532 | |
| 533 | const auto thread = idm::get<named_thread<ppu_thread>>( |
| 534 | thread_id, |
| 535 | [&, notify = lv2_obj::notify_all_t()](ppu_thread &thread) -> CellError { |
| 536 | if (!thread.state.test_and_reset(cpu_flag::stop)) { |
| 537 | // Already started |
| 538 | return CELL_EBUSY; |
| 539 | } |
| 540 | |
| 541 | ensure(lv2_obj::awake(&thread)); |
| 542 | |
| 543 | thread.cmd_list({ |
| 544 | {ppu_cmd::entry_call, 0}, |
| 545 | }); |
| 546 | |
| 547 | return {}; |
| 548 | }); |
| 549 | |
| 550 | if (!thread) { |
| 551 | return CELL_ESRCH; |
| 552 | } |
| 553 | |
| 554 | if (thread.ret) { |
| 555 | return thread.ret; |
| 556 | } else { |
| 557 | thread->cmd_notify.store(1); |
| 558 | thread->cmd_notify.notify_one(); |
| 559 | } |
| 560 | |
| 561 | return CELL_OK; |
| 562 | } |
| 563 | |
| 564 | error_code sys_ppu_thread_rename(ppu_thread &ppu, u32 thread_id, |
| 565 | vm::cptr<char> name) { |
no test coverage detected