Skip to main content

ParkUntilFn

Type Alias ParkUntilFn 

Source
pub type ParkUntilFn = unsafe extern "C" fn(ctx: *mut c_void, deadline_us: u64) -> i8;
Expand description

Park until deadline_us from now, or until something signals, whichever comes first.

Returns PARK_SIGNALLED (0) when woken by an event, PARK_EXPIRED (1) when the deadline expired, PARK_YIELDED (2) when the slot did not wait but handed the wait to its framework’s scheduler, and a negative value when this build cannot park at all.

phase-521 W8 (c) (RFC-0113 D9, ruling 2026-11-03) – the YIELDED answer is how a tier that a framework schedules waits: a PX4 tier’s slot arms its work item’s ScheduleDelayed(deadline_us) (or ScheduleClear() when the bound is the caller’s budget alone) and returns at once, and spin_once then returns to the work queue instead of blocking. An arrival reaches the tier through ScheduleNow(). No executor API widens for it: the bound the slot receives is the one every park receives.

A DEADLINE, not a duration, and that distinction is what makes bare metal work: nros-baremetal-common’s own note says wfi with no pending interrupt deadlocks, so a board must arm a timer compare BEFORE waiting. A sleep(duration) seam cannot express that — the sleeper does not know whether anyone armed an interrupt. A ParkUntilFn does, because the deadline is exactly what the compare is armed to.