Skip to main content

preempt_guard_enter

Function preempt_guard_enter 

Source
pub fn preempt_guard_enter() -> PreemptGuardToken
Expand description

Prevents the current task context from being preempted or migrated.

This capability does not disable hardware interrupts. It is valid only in task context or inside an active scheduler frame; scheduler state shared with hard-IRQ producers uses the separate IRQ-safe lock domain.

When an enclosing scheduler frame or runtime IRQ guard already owns the CPU for the complete lock scope, the runtime returns PreemptGuardToken::NONE. The matching lock guard then releases only its raw lock; it must not manufacture another ordinary preemption depth inside the existing owner transaction.