Skip to main content
← PSoXide SDK guides and examples · SDK 80d1c329e977 · All Cargo features enabled; check feature gates before use.

set_idle_hook

Function set_idle_hook 

Source
pub fn set_idle_hook(hook: Option<fn()>)
Expand description

Install (or with None remove) a function the polled reader calls from every spin of every wait it makes (a seek, the next sector of a read, a command’s acknowledge) and so between the sectors of any load built on it.

It is how a program keeps something moving while it blocks on the disc: the psx-loading widget polls from here, so one hook animates every polled load the program does, whichever crate issues it (pack table scans and chunk reads included). The hook runs with the drive owned by the reader: it must not touch the CD controller, and it must return at once when there is nothing to do, because it runs thousands of times a second. It is global, one at a time.