Lines Matching full:guard
3 //! Generic kernel lock and guard.
5 //! It contains a generic Rust lock and guard that allow for different backends (e.g., mutexes,
169 pub fn lock(&self) -> Guard<'_, T, B> { in lock()
174 unsafe { Guard::new(self, state) } in lock()
179 /// Returns a guard that can be used to access the data protected by the lock if successful.
180 pub fn try_lock(&self) -> Option<Guard<'_, T, B>> { in try_lock()
183 unsafe { B::try_lock(self.state.get()).map(|state| Guard::new(self, state)) } in try_lock()
187 /// A lock guard.
190 /// when a guard goes out of scope. It also provides a safe and convenient way to access the data
192 #[must_use = "the lock unlocks immediately when the guard is unused"]
193 pub struct Guard<'a, T: ?Sized, B: Backend> { struct
199 // SAFETY: `Guard` is sync when the data protected by the lock is also sync. argument
200 unsafe impl<T: Sync + ?Sized, B: Backend> Sync for Guard<'_, T, B> {} implementation
202 impl<T: ?Sized, B: Backend> Guard<'_, T, B> { impl
215 impl<T: ?Sized, B: Backend> core::ops::Deref for Guard<'_, T, B> { implementation
224 impl<T: ?Sized, B: Backend> core::ops::DerefMut for Guard<'_, T, B> { implementation
231 impl<T: ?Sized, B: Backend> Drop for Guard<'_, T, B> { implementation
238 impl<'a, T: ?Sized, B: Backend> Guard<'a, T, B> { implementation
239 /// Constructs a new immutable lock guard.