Lines Matching +full:reference +full:- +full:sync

1 // SPDX-License-Identifier: GPL-2.0
10 use crate::{bindings, prelude::*, sync::rcu, types::Opaque};
15 sync::atomic::{AtomicBool, Ordering},
33 /// fn add_two(v: &Revocable<Example>) -> Option<u32> {
48 /// use kernel::sync::rcu;
55 /// fn add_two(v: &Revocable<Example>) -> Option<u32> {
78 // SAFETY: `Revocable` is `Sync` if the wrapped object is both `Send` and `Sync`. We require `Send`
81 unsafe impl<T: Sync + Send> Sync for Revocable<T> {}
85 pub fn new<E>(data: impl PinInit<T, E>) -> impl PinInit<Self, E> { in new()
88 data <- Opaque::pin_init(data), in new()
99 pub fn try_access(&self) -> Option<RevocableGuard<'_, T>> { in try_access()
114 /// Returns a shared reference to the object otherwise; the object is guaranteed to
118 pub fn try_access_with_guard<'a>(&'a self, _guard: &'a rcu::Guard) -> Option<&'a T> { in try_access_with_guard()
130 /// This is a convenience method to run short non-sleepable code blocks while ensuring the
140 pub fn try_access_with<R, F: FnOnce(&T) -> R>(&self, f: F) -> Option<R> { in try_access_with()
150 pub unsafe fn access(&self) -> &T { in access()
159 unsafe fn revoke_internal<const SYNC: bool>(&self) -> bool { in revoke_internal()
163 if SYNC { in revoke_internal()
187 pub unsafe fn revoke_nosync(&self) -> bool { in revoke_nosync()
204 pub fn revoke(&self) -> bool { in revoke()
221 // holds the only reference (mutable) to `self` now. in drop()
230 /// holding the RCU read-side lock.
234 /// The RCU read-side lock is held while the guard is alive.
246 fn new(data_ref: *const T, rcu_guard: rcu::Guard) -> Self { in new()
258 fn deref(&self) -> &Self::Target { in deref()
259 // SAFETY: By the type invariants, we hold the rcu read-side lock, so the object is in deref()