| 309 | } |
| 310 | |
| 311 | error_code sys_ppu_thread_set_priority(ppu_thread &ppu, u32 thread_id, |
| 312 | s32 prio) { |
| 313 | ppu.state += cpu_flag::wait; |
| 314 | |
| 315 | sys_ppu_thread.trace("sys_ppu_thread_set_priority(thread_id=0x%x, prio=%d)", |
| 316 | thread_id, prio); |
| 317 | |
| 318 | if (prio < (g_ps3_process_info.debug_or_root() ? -512 : 0) || prio > 3071) { |
| 319 | return CELL_EINVAL; |
| 320 | } |
| 321 | |
| 322 | if (thread_id == ppu.id) { |
| 323 | // Fast path for self |
| 324 | if (ppu.prio.load().prio != prio) { |
| 325 | lv2_obj::set_priority(ppu, prio); |
| 326 | } |
| 327 | |
| 328 | return CELL_OK; |
| 329 | } |
| 330 | |
| 331 | const auto thread = idm::check<named_thread<ppu_thread>>( |
| 332 | thread_id, [&, notify = lv2_obj::notify_all_t()](ppu_thread &thread) { |
| 333 | lv2_obj::set_priority(thread, prio); |
| 334 | }); |
| 335 | |
| 336 | if (!thread) { |
| 337 | return CELL_ESRCH; |
| 338 | } |
| 339 | |
| 340 | return CELL_OK; |
| 341 | } |
| 342 | |
| 343 | error_code sys_ppu_thread_get_priority(ppu_thread &ppu, u32 thread_id, |
| 344 | vm::ptr<s32> priop) { |
nothing calls this directly
no test coverage detected