diff options
author | 2022-12-28 06:03:45 +0000 | |
---|---|---|
committer | 2023-01-16 23:48:06 +0100 | |
commit | 70e42ebbf6416e8005d8e08ae521b7d5cc5a8b3a (patch) | |
tree | 7b53101eef75b58f2cd4142ea18b2c775c654dbc /rust/kernel/sync.rs | |
parent | rust: sync: allow type of `self` to be `ArcBorrow<T>` (diff) | |
download | linux-70e42ebbf6416e8005d8e08ae521b7d5cc5a8b3a.tar.gz linux-70e42ebbf6416e8005d8e08ae521b7d5cc5a8b3a.tar.bz2 linux-70e42ebbf6416e8005d8e08ae521b7d5cc5a8b3a.zip |
rust: sync: introduce `UniqueArc`
Since `Arc<T>` does not allow mutating `T` directly (i.e., without inner
mutability), it is currently not possible to do some initialisation of
`T` post construction but before being shared.
`UniqueArc<T>` addresses this problem essentially being an `Arc<T>` that
has a refcount of 1 and is therefore writable. Once initialisation is
completed, it can be transitioned (without failure paths) into an
`Arc<T>`.
Suggested-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Acked-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel/sync.rs')
-rw-r--r-- | rust/kernel/sync.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs index 5de03ea83ea1..33da23e3076d 100644 --- a/rust/kernel/sync.rs +++ b/rust/kernel/sync.rs @@ -7,4 +7,4 @@ mod arc; -pub use arc::{Arc, ArcBorrow}; +pub use arc::{Arc, ArcBorrow, UniqueArc}; |