Struct preemption::PreemptionGuard
source · pub struct PreemptionGuard { /* private fields */ }
Expand description
A guard type that ensures preemption is disabled as long as it is held.
Call hold_preemption()
to obtain a PreemptionGuard
.
Preemption may be re-enabled when this guard is dropped,
but not necessarily so, because other previous functions
in the call stack may have already acquired a PreemptionGuard
.
This type does not implement Send
because it is invalid
to move it across a “thread” boundary (into a different task).
More specifically, it is invalid to move a PreemptionGuard
across
CPUs; this error condition is checked for when dropping it.
Implementations§
source§impl PreemptionGuard
impl PreemptionGuard
sourcepub fn preemption_was_enabled(&self) -> bool
pub fn preemption_was_enabled(&self) -> bool
Returns whether preemption was originally enabled when this guard was created.
Return
true
: indicates that the caller function/task holding this guard was the one that caused the transition from preemption being enabled on this CPU to being disabled.false
: indicates that preemption was already disabled and that no transition occurred when the caller function/task obtained this guard.
Trait Implementations§
source§impl Debug for PreemptionGuard
impl Debug for PreemptionGuard
source§impl Drop for PreemptionGuard
impl Drop for PreemptionGuard
impl !Send for PreemptionGuard
Auto Trait Implementations§
impl RefUnwindSafe for PreemptionGuard
impl Sync for PreemptionGuard
impl Unpin for PreemptionGuard
impl UnwindSafe for PreemptionGuard
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more