Lines Matching defs:Backend

34 /// [`lock`]: Backend::lock
35 /// [`unlock`]: Backend::unlock
36 /// [`relock`]: Backend::relock
37 pub unsafe trait Backend {
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> {
123 unsafe impl<T: ?Sized + Send, B: Backend> Send for Lock<T, B> {}
127 unsafe impl<T: ?Sized + Send, B: Backend> Sync for Lock<T, B> {}
129 impl<T, B: Backend> Lock<T, B> {
148 impl<B: Backend> Lock<(), B> {
158 /// [`State`]: Backend::State
171 impl<T: ?Sized, B: Backend> Lock<T, B> {
197 /// Allows mutual exclusion primitives that implement the [`Backend`] trait to automatically unlock
201 pub struct Guard<'a, T: ?Sized, B: Backend> {
208 unsafe impl<T: Sync + ?Sized, B: Backend> Sync for Guard<'_, T, B> {}
210 impl<'a, T: ?Sized, B: Backend> Guard<'a, T, B> {
219 /// # use kernel::{new_spinlock, sync::lock::{Backend, Guard, Lock}};
222 /// fn assert_held<T, B: Backend>(guard: &Guard<'_, T, B>, lock: &Lock<T, B>) {
278 impl<T: ?Sized, B: Backend> core::ops::Deref for Guard<'_, T, B> {
288 impl<T: ?Sized, B: Backend> core::ops::DerefMut for Guard<'_, T, B>
299 impl<T: ?Sized, B: Backend> Drop for Guard<'_, T, B> {
307 impl<'a, T: ?Sized, B: Backend> Guard<'a, T, B> {
315 // SAFETY: The caller can only hold the lock if `Backend::init` has already been called.