lkml.org 
[lkml]   [2023]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] rust: arc: remove `ArcBorrow` in favour of `WithRef`
On Thu, 21 Sep 2023 18:34:40 -0300
Wedson Almeida Filho <wedsonaf@gmail.com> wrote:

> From: Wedson Almeida Filho <walmeida@microsoft.com>
>
> With GATs, we don't need a separate type to represent a borrowed object
> with a refcount, we can just use Rust's regular shared borrowing. In
> this case, we use `&WithRef<T>` instead of `ArcBorrow<'_, T>`.
>
> Co-developed-by: Boqun Feng <boqun.feng@gmail.com>
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>

Reviewed-by: Gary Guo <gary@garyguo.net>

The implementation looks good to me, thanks Wedson.

A minor thing that worth considering is to implement `AlwaysRefCounted`
to `WithRef` and reimplement `Arc` with `ARef<TaskRef<T>>` or add
conversion functions between them.

It feels natural to have this this impl (because `WithRef` is indeed
always ref counted), but on the other hand I don't currently foresee
anyone to currently want to use this API :(

> ---
> rust/kernel/sync.rs | 2 +-
> rust/kernel/sync/arc.rs | 180 ++++++++++++++--------------------------
> 2 files changed, 62 insertions(+), 120 deletions(-)

\
 
 \ /
  Last update: 2023-09-23 02:13    [W:0.100 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site