//! UI-thread priority boost (docs/BUGS/scroll-jank-120hz.md ยง4.1, egui //! port). The phone's default UI-thread priority (nice 0) gets descheduled //! 30โ€“100 ms under ambient load โ€” the measured stall class. `set_self_nice` //! sets the CALLING thread to nice -10 (the UI thread) or +2 (the decode //! threads, so they never compete with the UI thread). //! //! Bionic's `setpriority(PRIO_THREAD, 0, n)` acts on exactly the calling //! thread (no /proc, no JNI โ€” the old Slint build needed a JNI //! `setThreadPriority` round-trip for foreign threads; winit 0.30 runs the //! loop on the calling thread itself, so nothing foreign ever needs //! adjusting). #[cfg(target_os = "android")] extern "C" { fn setpriority(which: i32, who: u32, prio: i32) -> i32; } #[cfg(target_os = "android")] pub fn set_self_nice(nice: i32) { const PRIO_THREAD: i32 = 5; unsafe { setpriority(PRIO_THREAD, 0, nice); } } #[cfg(not(target_os = "android"))] pub fn set_self_nice(_nice: i32) {}