Skip to main content

prepare_thread_switch

Function prepare_thread_switch 

Source
pub unsafe fn prepare_thread_switch<'switch>(
    pin: &'switch CpuPin<'_>,
    previous: Pin<&CurrentThreadHeader>,
    next: Pin<&CurrentThreadHeader>,
) -> Result<(PreparedThreadSwitch<'switch>, PreviousThreadBinding), ThreadSwitchError>
Expand description

Validates and binds a complete scheduler thread switch transaction.

All fallible validation occurs before the returned prepared token can be committed. Dropping the prepared token automatically rolls back next.

ยงSafety

The caller must own the IRQ-disabled scheduler switch path. Both headers must remain pinned and alive through the raw switch and incoming tail.