Lines Matching full:backend
22 /// The "backend" of a lock.
34 /// [`lock`]: Backend::lock
35 /// [`unlock`]: Backend::unlock
36 /// [`relock`]: Backend::relock
37 pub unsafe trait Backend { trait
43 /// [`lock`]: Backend::lock
44 /// [`unlock`]: Backend::unlock
63 /// Callers must ensure that [`Backend::init`] has been previously called.
71 /// Callers must ensure that [`Backend::init`] has been previously called.
85 /// Callers must ensure that `guard_state` comes from a previous call to [`Backend::lock`] (or
86 /// variant) that has been unlocked with [`Backend::unlock`] and will be relocked now.
96 /// Callers must ensure that [`Backend::init`] has been previously called.
103 /// [`Backend`] specified as the generic parameter `B`.
106 pub struct Lock<T: ?Sized, B: Backend> {
122 unsafe impl<T: ?Sized + Send, B: Backend> Send for Lock<T, B> {}
126 unsafe impl<T: ?Sized + Send, B: Backend> Sync for Lock<T, B> {}
128 impl<T, B: Backend> Lock<T, B> {
143 impl<B: Backend> Lock<(), B> {
153 /// [`State`]: Backend::State
165 impl<T: ?Sized, B: Backend> Lock<T, B> {
187 /// Allows mutual exclusion primitives that implement the [`Backend`] trait to automatically unlock
191 pub struct Guard<'a, T: ?Sized, B: Backend> {
198 unsafe impl<T: Sync + ?Sized, B: Backend> Sync for Guard<'_, T, B> {}
200 impl<'a, T: ?Sized, B: Backend> Guard<'a, T, B> {
209 /// # use kernel::{new_spinlock, sync::lock::{Backend, Guard, Lock}};
212 /// fn assert_held<T, B: Backend>(guard: &Guard<'_, T, B>, lock: &Lock<T, B>) {
243 impl<T: ?Sized, B: Backend> core::ops::Deref for Guard<'_, T, B> {
252 impl<T: ?Sized, B: Backend> core::ops::DerefMut for Guard<'_, T, B> {
259 impl<T: ?Sized, B: Backend> Drop for Guard<'_, T, B> {
266 impl<'a, T: ?Sized, B: Backend> Guard<'a, T, B> {
273 // SAFETY: The caller can only hold the lock if `Backend::init` has already been called. in new()