Lines Matching +full:reference +full:- +full:sync
1 // SPDX-License-Identifier: GPL-2.0
28 /// compile-time that access to `InnerFile` is only granted when an `InnerDirectory` is also
32 /// use kernel::sync::{LockedBy, Mutex};
71 /// fn new_file(ino: u32, dir: &Directory) -> File {
86 // SAFETY: If `T` is not `Sync`, then parallel shared access to this `LockedBy` allows you to use
90 // If `T` is `Sync`, then the `access` method also becomes available, which allows you to obtain
91 // several `&T` from several threads at once. However, this is okay as `T` is `Sync`.
92 unsafe impl<T: ?Sized + Send, U: ?Sized> Sync for LockedBy<T, U> {}
102 pub fn new<B: Backend>(owner: &Lock<U, B>, data: T) -> Self { in new()
115 /// Returns a reference to the protected data when the caller provides evidence (via a
116 /// reference) that the owner is locked.
118 /// `U` cannot be a zero-sized type (ZST) because there are ways to get an `&U` that matches
125 pub fn access<'a>(&'a self, owner: &'a U) -> &'a T in access()
127 T: Sync, in access()
139 // reference to the inner value that aliases with this shared reference. The type is `Sync` in access()
144 /// Returns a mutable reference to the protected data when the caller provides evidence (via a
147 /// `U` cannot be a zero-sized type (ZST) because there are ways to get an `&mut U` that
150 /// Showing a mutable reference to the owner is sufficient because we know no other references
157 pub fn access_mut<'a>(&'a self, owner: &'a mut U) -> &'a mut T { in access_mut()
166 // SAFETY: `owner` is evidence that there is only one reference to the owner. in access_mut()