Skip to main content

finish_initial_context_switch

Function finish_initial_context_switch 

Source
pub unsafe fn finish_initial_context_switch() -> Result<(), TaskError>
Expand description

Completes switch tail and consumes the inherited IRQ guard on first entry.

Fresh context trampolines must invoke this before accessing thread-local state, enabling interrupts, polling futures, or calling user/OS code. Resumed contexts must not call it because their suspended scheduler guard consumes the same baton when the architecture switch returns.

§Safety

The caller must be the first instruction sequence of a freshly switched-in context. Exactly one scheduler IRQ guard must be inherited on this CPU, and this function must be called exactly once for that context’s first entry.