Lines Matching defs:Revocable
3 //! Revocable objects.
5 //! The [`Revocable`] type wraps other types and allows access to them to be revoked. The existence
35 /// # use kernel::revocable::Revocable;
42 /// fn add_two(v: &Revocable<Example>) -> Option<u32> {
47 /// let v = KBox::pin_init(Revocable::new(Example { a: 10, b: 20 }), GFP_KERNEL).unwrap();
56 /// # use kernel::revocable::Revocable;
64 /// fn add_two(v: &Revocable<Example>) -> Option<u32> {
70 /// let v = KBox::pin_init(Revocable::new(Example { a: 10, b: 20 }), GFP_KERNEL).unwrap();
76 pub struct Revocable<T> {
82 // SAFETY: `Revocable` is `Send` if the wrapped object is also `Send`. This is because while the
83 // functionality exposed by `Revocable` can be accessed from any thread/CPU, it is possible that
85 unsafe impl<T: Send> Send for Revocable<T> {}
87 // SAFETY: `Revocable` is `Sync` if the wrapped object is both `Send` and `Sync`. We require `Send`
88 // from the wrapped object as well because of `Revocable::revoke`, which can trigger the `Drop`
90 unsafe impl<T: Sync + Send> Sync for Revocable<T> {}
92 impl<T> Revocable<T> {
157 /// The caller must ensure this [`Revocable`] instance hasn't been revoked and won't be revoked
186 /// Access to the object is revoked immediately to new callers of [`Revocable::try_access`],
204 /// Access to the object is revoked immediately to new callers of [`Revocable::try_access`].
207 /// [`Revocable::try_access`] beforehand and still haven't dropped the returned guard), this
220 impl<T> PinnedDrop for Revocable<T> {