Lines Matching +full:reference +full:- +full:sync
1 // SPDX-License-Identifier: GPL-2.0
12 sync::{
42 /// fn add_two(v: &Revocable<Example>) -> Option<u32> {
57 /// use kernel::sync::rcu;
64 /// fn add_two(v: &Revocable<Example>) -> Option<u32> {
87 // SAFETY: `Revocable` is `Sync` if the wrapped object is both `Send` and `Sync`. We require `Send`
90 unsafe impl<T: Sync + Send> Sync for Revocable<T> {}
94 pub fn new<E>(data: impl PinInit<T, E>) -> impl PinInit<Self, E> {
97 data <- Opaque::pin_init(data),
108 pub fn try_access(&self) -> Option<RevocableGuard<'_, T>> {
123 /// Returns a shared reference to the object otherwise; the object is guaranteed to
127 pub fn try_access_with_guard<'a>(&'a self, _guard: &'a rcu::Guard) -> Option<&'a T> {
139 /// This is a convenience method to run short non-sleepable code blocks while ensuring the
149 pub fn try_access_with<R, F: FnOnce(&T) -> R>(&self, f: F) -> Option<R> {
159 pub unsafe fn access(&self) -> &T {
168 unsafe fn revoke_internal<const SYNC: bool>(&self) -> bool {
172 if SYNC {
195 pub unsafe fn revoke_nosync(&self) -> bool {
212 pub fn revoke(&self) -> bool {
229 // holds the only reference (mutable) to `self` now.
238 /// holding the RCU read-side lock.
242 /// The RCU read-side lock is held while the guard is alive.
254 fn new(data_ref: *const T, rcu_guard: rcu::Guard) -> Self {
266 fn deref(&self) -> &Self::Target {
267 // SAFETY: By the type invariants, we hold the rcu read-side lock, so the object is