diff options
author | Alice Ryhl <[email protected]> | 2024-04-02 13:07:43 +0000 |
---|---|---|
committer | Miguel Ojeda <[email protected]> | 2024-05-05 18:04:31 +0200 |
commit | a0a4e17013f68739733028bba89673cdbb9caabd (patch) | |
tree | da40634ba40ccef871d9bb55d625c68f08c8a687 /rust/kernel/alloc/allocator.rs | |
parent | 51f6af86de35bfd12a005caf457f2ec834193de8 (diff) |
rust: sync: add `Arc::into_unique_or_drop`
Decrement the refcount of an `Arc`, but handle the case where it hits
zero by taking ownership of the now-unique `Arc`, instead of destroying
and deallocating it.
This is a dependency of the linked list that Rust Binder uses. The
linked list uses this method as part of its `ListArc` abstraction [1].
Boqun Feng has authored the examples.
Reviewed-by: Benno Lossin <[email protected]>
Reviewed-by: Boqun Feng <[email protected]>
Link: https://lore.kernel.org/r/[email protected] [1]
Co-developed-by: Boqun Feng <[email protected]>
Signed-off-by: Boqun Feng <[email protected]>
Signed-off-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Replace `try_new` with `new` in example since we now have the new
allocation APIs. - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/kernel/alloc/allocator.rs')
0 files changed, 0 insertions, 0 deletions