mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Every wait with a timeout behaves the same on hardware (pspautotests threads/scheduling/waittimeouts). The deadline is taken, and the alarm set up a moment later. If the deadline has passed by then, the wait fails with WAIT_TIMEOUT at once, without yielding or writing the timeout back. That's usual for 0us, half the time for 1us, and rare after; AllocateVpl does more first. Otherwise it ends max(t, 205us) + ~35us after the call. Each object had its own guess (24/245, 25/250, 20/250 and so on), and only MsgPipe had the immediate case. __KernelWaitTimesOutAtOnce() and __KernelWaitTimeoutUs() now do it for semaphores, event flags, mutexes, lwmutexes, mbx, msgpipes, fpl, vpl and WaitThreadEnd. The latency past the deadline isn't counted in the time left written back. Outcomes that hardware decides by the clock's phase (these, and sceKernelDelayThread returning at once) go with the likelier one. Ones between 50% and certain are instead spread evenly over calls, so a polling loop can't lock into never yielding (sceKernelThread section version 7). This replaces the pseudo-random choice for delays. Also adds threads/scheduling/readyqueue, which already passes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>