[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ODK_F29--F-9@tuta.io>
Date: Thu, 5 Dec 2024 07:49:50 +0100 (CET)
From: jens.korinth@...a.io
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>,
Rust For Linux <rust-for-linux@...r.kernel.org>,
FUJITA Tomonori <fujita.tomonori@...il.com>,
Dirk Behme <dirk.behme@...il.com>,
Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 1/3] rust: Add `OnceLite` for executing code once
I'm afraid you lost me. You wrote:
> Using a Once type for this seems like a good idea to me.
and
> One advantage of using a Once type is that we can use core::sync::atomic
> until we have working LKMM atomics and then we just swap out the Once
> type without having to modify the warn_once abstractions.
That made sense to me, so I started in this direction. `std::sync::Once`
has `is_completed` [1], which made particular sense to implement in my
mind to increase the utility of `OnceLite`.
[1]: https://doc.rust-lang.org/std/sync/struct.Once.html#method.is_completed
> The purpose is to use this for printing once, and printing doesn't need
> `is_completed`. We can have another helper for other purposes.
Why have `OnceLite` then at all, instead of the hidden Rust macro that was
proposed initially?
Jens
Powered by blists - more mailing lists