From: Oliver Mangold <oliver.mangold@pm.me>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Asahi Lina" <lina@asahilina.net>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 4/4] rust: adding OwnableRefCounted and SimpleOwnableRefCounted
Date: Wed, 12 Mar 2025 10:37:29 +0000 [thread overview]
Message-ID: <Z9Fj5nROnMkj8Oau@mango> (raw)
In-Reply-To: <Z88lzDPsO7UStQ85@boqun-archlinux>
On 250310 1047, Boqun Feng wrote:
> On Mon, Mar 10, 2025 at 10:57:47AM +0000, Oliver Mangold wrote:
> > +pub unsafe trait SimpleOwnableRefCounted {
>
> Can you make this trait as a sub-trait of RefCounted:
>
> pub unsafe trait SimpleOwnableRefCounted: RefCounted {
> fn is_unique(&self) -> bool;
> }
>
> ?
>
Good idea. Simplifies things. Will do that.
> > + /// Checks if exactly one [`ARef`] to the object exists. In case the object is [`Sync`], the
> > + /// check needs to be race-free.
> > + fn is_unique(&self) -> bool;
> > +
> > + /// Increments the reference count on the object.
> > + fn inc_ref(&self);
> > +
> > + /// Decrements the reference count on the object when the [`SimpleOwnableRefCounted`] is
>
> Should be:
>
> "... when ARef<SimpleOwnableRefCounted> or
> Owned<SimpleOwnableRefCounted> is dropped"
>
> ?
>
> > + /// dropped.
> > + ///
> > + /// Frees the object when the count reaches zero.
>
> It may not end up freeing the object, because ARef<..> only tracks the
> Rust side of refcounting, we should avoid mentioning "refcount reaching
> to zero" here.
>
This docu will vanish together with the functions, of course, after the change
above. One might note, though, that the last comment was a copy-paste from
AlwaysRefCounted (now RefCounted) where it still exists identically.
Best regards,
Oliver
next prev parent reply other threads:[~2025-03-12 10:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 10:57 [PATCH v7 0/4] New trait OwnableRefCounted for ARef<->Owned conversion Oliver Mangold
2025-03-10 10:57 ` [PATCH v7 1/4] rust: types: Add Ownable/Owned types Oliver Mangold
2025-03-10 17:04 ` Boqun Feng
2025-03-10 10:57 ` [PATCH v7 2/4] rust: rename AlwaysRefCounted to RefCounted Oliver Mangold
2025-03-10 17:10 ` Boqun Feng
2025-03-10 10:57 ` [PATCH v7 3/4] rust: kbuild: provide `RUSTC_HAS_DO_NOT_RECOMMEND` symbol Oliver Mangold
2025-03-10 10:57 ` [PATCH v7 4/4] rust: adding OwnableRefCounted and SimpleOwnableRefCounted Oliver Mangold
2025-03-10 17:47 ` Boqun Feng
2025-03-12 10:37 ` Oliver Mangold [this message]
2025-03-10 15:42 ` [PATCH v7 0/4] New trait OwnableRefCounted for ARef<->Owned conversion Miguel Ojeda
2025-03-12 9:19 ` Oliver Mangold
2025-03-12 12:02 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z9Fj5nROnMkj8Oau@mango \
--to=oliver.mangold@pm.me \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=lina@asahilina.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.