Lines Matching defs:Arc
36 //! use kernel::sync::Arc;
51 //! fn new(value: i32) -> Result<Arc<Self>> {
52 //! Arc::pin_init(pin_init!(MyStruct {
60 //! type Pointer = Arc<MyStruct>;
62 //! fn run(this: Arc<MyStruct>) {
69 //! fn print_later(val: Arc<MyStruct>) {
78 //! use kernel::sync::Arc;
97 //! fn new(value_1: i32, value_2: i32) -> Result<Arc<Self>> {
98 //! Arc::pin_init(pin_init!(MyStruct {
108 //! type Pointer = Arc<MyStruct>;
110 //! fn run(this: Arc<MyStruct>) {
116 //! type Pointer = Arc<MyStruct>;
118 //! fn run(this: Arc<MyStruct>) {
123 //! fn print_1_later(val: Arc<MyStruct>) {
124 //! let _ = workqueue::system().enqueue::<Arc<MyStruct>, 1>(val);
127 //! fn print_2_later(val: Arc<MyStruct>) {
128 //! let _ = workqueue::system().enqueue::<Arc<MyStruct>, 2>(val);
137 //! use kernel::sync::Arc;
152 //! fn new(value: i32) -> Result<Arc<Self>> {
153 //! Arc::pin_init(
164 //! type Pointer = Arc<MyStruct>;
166 //! fn run(this: Arc<MyStruct>) {
173 //! fn print_later(val: Arc<MyStruct>) {
179 //! fn print_now(val: Arc<MyStruct>) {
192 sync::Arc,
428 /// This trait is implemented by `Pin<KBox<T>>` and [`Arc<T>`], and is mainly intended to be
459 /// The pointer type that this struct is wrapped in. This will typically be `Arc<Self>` or
586 /// use kernel::sync::Arc;
739 /// use kernel::sync::Arc;
814 // implementation of `WorkItemPointer` for `Arc<T>`.
815 unsafe impl<T, const ID: u64> WorkItemPointer<ID> for Arc<T>
823 // SAFETY: This computes the pointer that `__enqueue` got from `Arc::into_raw`.
825 // SAFETY: This pointer comes from `Arc::into_raw` and we've been given back ownership.
826 let arc = unsafe { Arc::from_raw(ptr) };
833 // the closure because we get it from an `Arc`, which means that the ref count will be at least 1,
834 // and we don't drop the `Arc` ourselves. If `queue_work_on` returns true, it is further guaranteed
839 unsafe impl<T, const ID: u64> RawWorkItem<ID> for Arc<T>
851 let ptr = Arc::into_raw(self).cast_mut();
853 // SAFETY: Pointers into an `Arc` point at a valid value.
862 Err(unsafe { Arc::from_raw(ptr) })
870 unsafe impl<T, const ID: u64> RawDelayedWorkItem<ID> for Arc<T>
886 // SAFETY: This computes the pointer that `__enqueue` got from `Arc::into_raw`.
888 // SAFETY: This pointer comes from `Arc::into_raw` and we've been given back ownership.