LV2: Optimizations and fixes

Fix and optimize sys_ppu_thread_yield

Fix LV2 syscalls with timeout bug. (use ppu_thread::cancel_sleep instead)

Move timeout notification out of mutex scope

Allow g_waiting timeouts to be awaked in scope
This commit is contained in:
Elad Ashkenazi 2022-08-08 08:33:49 +03:00 committed by Ivan
parent cba4c3cdc4
commit c4cc0154be
10 changed files with 260 additions and 202 deletions

View file

@ -162,6 +162,8 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout)
lv2_obj::prepare_for_sleep(ppu);
ppu.cancel_sleep = 1;
if (s32 signal = mutex.try_own(&ppu))
{
if (signal == smin)
@ -169,12 +171,13 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout)
ppu.gpr[3] = CELL_EBUSY;
}
ppu.cancel_sleep = 0;
return true;
}
mutex.sleep(ppu, timeout);
const bool finished = !mutex.sleep(ppu, timeout);
notify.cleanup();
return false;
return finished;
});
if (!mutex)