Match hw timing of mutex/sema timeouts better.

Affects some tests passing/not passing due to minor timing issues, ugh.
This commit is contained in:
Unknown W. Brackets 2012-11-30 22:20:14 -08:00
parent 7164638799
commit 48c5efd0c2
2 changed files with 16 additions and 2 deletions

View file

@ -301,8 +301,15 @@ void __KernelSetSemaTimeout(Semaphore *s, u32 timeoutPtr)
if (timeoutPtr == 0 || semaWaitTimer == 0)
return;
// This should call __KernelMutexTimeout() later, unless we cancel it.
int micro = (int) Memory::Read_U32(timeoutPtr);
// This happens to be how the hardware seems to time things.
if (micro <= 3)
micro = 15;
else if (micro <= 249)
micro = 250;
// This should call __KernelSemaTimeout() later, unless we cancel it.
CoreTiming::ScheduleEvent(usToCycles(micro), semaWaitTimer, __KernelGetCurThread());
}