sys_cond_wait: Wait for rescheduling before relocking

This commit is contained in:
Eladash 2019-08-25 06:06:27 +03:00 committed by Ivan
parent 3317e13b64
commit 35a3bed91a
1 changed files with 5 additions and 0 deletions

View File

@ -264,6 +264,9 @@ error_code sys_cond_wait(ppu_thread& ppu, u32 cond_id, u64 timeout)
{
if (lv2_obj::wait_timeout(timeout, &ppu))
{
// Wait for rescheduling
ppu.check_state();
std::lock_guard lock(cond->mutex->mutex);
// Try to cancel the waiting
@ -278,6 +281,8 @@ error_code sys_cond_wait(ppu_thread& ppu, u32 cond_id, u64 timeout)
{
break;
}
cond->mutex->sleep(ppu);
}
timeout = 0;