Skip to main content

KMutexAliasedGuard

Struct KMutexAliasedGuard 

Source
pub struct KMutexAliasedGuard<'a, Class1: LockClass, Class2: LockClass, M1: RawLock = RawMutex, M2: RawLock = M1, P: LockPolicy<M1> = <M1 as RawLock>::DefaultPolicy> { /* private fields */ }
Expand description

A validation guard representing ownership of two aliased locks simultaneously.

Only the first lock is physically acquired, but proof tokens for both lock classes (Class1 and Class2) are provided.

Implementations§

Source§

impl<'a, Class1: LockClass, Class2: LockClass, M1: RawLock, M2: RawLock, P: LockPolicy<M1>> KMutexAliasedGuard<'a, Class1, Class2, M1, M2, P>

Source

pub fn project<'__pin>( self: Pin<&'__pin mut Self>, ) -> KMutexAliasedGuardProjection<'__pin, 'a, Class1, Class2, M1, M2, P>

Pin-projects all fields of Self.

These fields are structurally pinned:

  • inner

These fields are not structurally pinned:

  • token2
  • _phantom
Source§

impl<'a, Class1: LockClass, Class2: LockClass, M1: RawLock, M2: RawLock, P: LockPolicy<M1>> KMutexAliasedGuard<'a, Class1, Class2, M1, M2, P>

Source

pub fn new( lock1: &'a KMutex<Class1, M1>, lock2: &'a KMutex<Class2, M2>, ) -> impl PinInit<Self, Infallible>
where P: LockPolicy<M1, AcquireArgs = ()>,

Creates a new stack-pinned aliased validation guard initialization block.

Source

pub fn new_with_args( lock1: &'a KMutex<Class1, M1>, _lock2: &'a KMutex<Class2, M2>, args: P::AcquireArgs, ) -> impl PinInit<Self, Infallible>

Creates a new stack-pinned aliased validation guard initialization block with policy acquire arguments.

Source

pub fn tokens(&self) -> (&LockToken<'a, Class1>, &LockToken<'a, Class2>)

Returns shared references to both lock proof tokens (Class1, Class2).

Source

pub fn tokens_mut( self: Pin<&mut Self>, ) -> (&mut LockToken<'a, Class1>, &mut LockToken<'a, Class2>)

Returns simultaneous mutable references to both proof tokens (Class1, Class2).

Source

pub fn token(&self) -> &LockToken<'a, Class1>

Returns a shared reference to the primary lock proof token (Class1).

Source

pub fn token_mut(self: Pin<&mut Self>) -> &mut LockToken<'a, Class1>

Returns a mutable reference to the primary lock proof token (Class1).

Source

pub fn inner_guard( self: Pin<&mut Self>, ) -> Pin<&mut KMutexGuard<'a, Class1, M1, P>>

Returns a pinned mutable reference to the primary inner KMutexGuard.

Source

pub fn call_unlocked<R, F: FnOnce() -> R>(self: Pin<&mut Self>, f: F) -> R

Temporarily releases the lock before executing the given callable f and then re-acquires the lock.

Source

pub fn call_untracked<R, F: FnOnce(&mut LockToken<'a, Class1>, &mut LockToken<'a, Class2>) -> R>( self: Pin<&mut Self>, f: F, ) -> R

Calls a closure while temporarily disabling lockdep tracking for the lock held by this guard.

Trait Implementations§

Source§

impl<'a, Class1: LockClass, Class2: LockClass, M1: RawLock, M2: RawLock, P: LockPolicy<M1>> HasPinData for KMutexAliasedGuard<'a, Class1, Class2, M1, M2, P>

Source§

type PinData = __ThePinData<'a, Class1, Class2, M1, M2, P>

Source§

unsafe fn __pin_data() -> Self::PinData

Auto Trait Implementations§

§

impl<'a, Class1, Class2, M1 = RawMutex, M2 = M1, P = <M1 as RawLock>::DefaultPolicy> !Send for KMutexAliasedGuard<'a, Class1, Class2, M1, M2, P>

§

impl<'a, Class1, Class2, M1 = RawMutex, M2 = M1, P = <M1 as RawLock>::DefaultPolicy> !Sync for KMutexAliasedGuard<'a, Class1, Class2, M1, M2, P>

§

impl<'a, Class1, Class2, M1, M2, P> Freeze for KMutexAliasedGuard<'a, Class1, Class2, M1, M2, P>
where <M1 as RawLock>::LockEntry: Freeze, <P as LockPolicy<M1>>::GuardState: Freeze,

§

impl<'a, Class1, Class2, M1, M2, P> RefUnwindSafe for KMutexAliasedGuard<'a, Class1, Class2, M1, M2, P>
where <M1 as RawLock>::LockEntry: RefUnwindSafe, <P as LockPolicy<M1>>::GuardState: RefUnwindSafe, M1: RefUnwindSafe, Class2: RefUnwindSafe, M2: RefUnwindSafe, Class1: RefUnwindSafe,

§

impl<'a, Class1, Class2, M1, M2, P> UnsafeUnpin for KMutexAliasedGuard<'a, Class1, Class2, M1, M2, P>
where <M1 as RawLock>::LockEntry: UnsafeUnpin, <P as LockPolicy<M1>>::GuardState: UnsafeUnpin,

§

impl<'a, Class1, Class2, M1, M2, P> UnwindSafe for KMutexAliasedGuard<'a, Class1, Class2, M1, M2, P>
where <M1 as RawLock>::LockEntry: UnwindSafe, <P as LockPolicy<M1>>::GuardState: UnwindSafe, M1: RefUnwindSafe, Class2: RefUnwindSafe, M2: RefUnwindSafe, Class1: RefUnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Init<T> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), !>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

Source§

impl<T> PinInit<T> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), !>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T> ToMutPtr for T
where T: ?Sized,

Source§

type Target = T

The target type of the pointer.
Source§

fn to_mut_ptr(&self) -> *mut T

Casts the reference to a mutable raw pointer.
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = !

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.