pub struct Lock<T: ?Sized, B: Backend> { /* private fields */ }Expand description
A mutual exclusion primitive.
Exposes one of the kernel locking primitives. Which one is exposed depends on the lock
Backend specified as the generic parameter B.
Implementations§
Source§impl<T: ?Sized> Lock<T, SpinLockIrqBackend>
impl<T: ?Sized> Lock<T, SpinLockIrqBackend>
Sourcepub fn lock_with<'a>(
&'a self,
context: &'a LocalInterruptDisabled,
) -> SpinLockGuard<'a, T>
pub fn lock_with<'a>( &'a self, context: &'a LocalInterruptDisabled, ) -> SpinLockGuard<'a, T>
Acquires the lock without modifying local interrupt state.
This function should be used in place of the more expensive Lock::lock() function when
possible for SpinLockIrq locks.
Sourcepub fn try_lock_with<'a>(
&'a self,
context: &'a LocalInterruptDisabled,
) -> Option<SpinLockGuard<'a, T>>
pub fn try_lock_with<'a>( &'a self, context: &'a LocalInterruptDisabled, ) -> Option<SpinLockGuard<'a, T>>
Tries to acquire the lock without modifying local interrupt state.
This function should be used in place of the more expensive Lock::try_lock() function
when possible for SpinLockIrq locks.
Returns a guard that can be used to access the data protected by the lock if successful.
Trait Implementations§
impl<T: ?Sized + Send, B: Backend> Send for Lock<T, B>
impl<T: ?Sized + Send, B: Backend> Sync for Lock<T, B>
Auto Trait Implementations§
impl<T, B> !Freeze for Lock<T, B>
impl<T, B> !RefUnwindSafe for Lock<T, B>
impl<T, B> !UnsafeUnpin for Lock<T, B>
impl<T, B> UnwindSafe for Lock<T, B>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
Source§fn into_safe_cast(self) -> T
fn into_safe_cast(self) -> T
Convert
self into a T. This operation is guaranteed to be lossless.Source§impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
Source§fn into_safe_cast_arch(self) -> T
fn into_safe_cast_arch(self) -> T
Convert
self into a T. This operation is guaranteed to be lossless.