LV2: Optimization for timeout

This commit is contained in:
Elad Ashkenazi 2024-06-12 08:42:03 +03:00
parent cec976b70a
commit f58b418b7d
5 changed files with 30 additions and 0 deletions

View file

@ -255,6 +255,12 @@ error_code sys_mutex_lock(ppu_thread& ppu, u32 mutex_id, u64 timeout)
continue;
}
if (!atomic_storage<ppu_thread*>::load(mutex->control.raw().sq))
{
// Waiters queue is empty, so the thread must have been signaled
break;
}
std::lock_guard lock(mutex->mutex);
bool success = false;