mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-23 00:36:42 -10:00
Answering whether the sleep and wall-clock reads the lock-free conversion introduced can go too, without falling back to semaphores: bionic's sem_timedwait wants an absolute CLOCK_REALTIME deadline - wall clock again, and jump-sensitive - and the portable semaphore is a mutex and condition variable inside, which brings back the very object the conversion removed. This driver is Android-only and Android is Linux, so the precise tool applies: the writer parks in the kernel on buffered_blocks' own address. FUTEX_WAIT takes a relative timeout, so the stall bound needs no deadline arithmetic and the hot path reads no clock; its compare-and-block removes even the lost-wakeup window the old condition variable had to tolerate, since a callback landing between the caller's test and the kernel's compare makes the wait return immediately. Both waits - sl_write's throttle and sl_wait_writable - convert, with the same timeout and the same stalled behavior. The callback stays syscall-free in the common case: it wakes the futex only when the new waiters counter says a writer is actually parked. EINTR re-arms the stall window, which detects dead devices and owes no precision. The one poll left is teardown's STOPPED confirmation: a foreign API's state transition has nothing to park on, so that single cold loop is now iteration-bounded rather than clock-bounded, once per session, normally satisfied on the first read. Also corrects the stub SLES header's outputMix locator to the real SLObjectItf type, so the file passes -Wall clean against the stubs. Verified: the android opensl matrix lane green with declaration-after-statement strictness, a -Wall -fsyntax-only pass with zero warnings, and the full 77-lane matrix.