[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250708172147.1d694eb1@nimda.home>
Date: Tue, 8 Jul 2025 17:21:47 +0300
From: Onur <work@...rozkan.dev>
To: "Benno Lossin" <lossin@...nel.org>
Cc: "Boqun Feng" <boqun.feng@...il.com>, <linux-kernel@...r.kernel.org>,
<rust-for-linux@...r.kernel.org>, <ojeda@...nel.org>,
<alex.gaynor@...il.com>, <gary@...yguo.net>, <a.hindborg@...nel.org>,
<aliceryhl@...gle.com>, <tmgross@...ch.edu>, <dakr@...nel.org>,
<peterz@...radead.org>, <mingo@...hat.com>, <will@...nel.org>,
<longman@...hat.com>, <felipe_life@...e.com>, <daniel@...lak.dev>,
<bjorn3_gh@...tonmail.com>
Subject: Re: [PATCH v5 2/3] implement ww_mutex abstraction for the Rust tree
On Mon, 07 Jul 2025 21:48:07 +0200
"Benno Lossin" <lossin@...nel.org> wrote:
> >> > Instead of `begin` and `custom`, why not something like this:
> >> >
> >> > let (a, c, d) = ctx.init()
> >> > .lock(a)
> >> > .lock(b)
> >> > .lock(c)
> >> > .unlock(b)
> >> > .lock(d)
> >> > .finish();
> >> >
> >> > Instead of `begin`, `init` would be better naming to imply `fini`
> >> > on the C side, and `unlock` instead of `custom` would make the
> >> > intent clearer when dropping locks mid chain.
>
> Also, I'm not really fond of the name `init`, how about `enter`?
I don't have a strong feeling on any of them, they are all the same
at some point. The reason why I suggested `init` was to keep it as
close/same as possible to the C implementation so people with C
knowledge would adapt to Rust implementation easier and quicker.
> Oh yeah the name was just a placeholder.
>
> The advantage of custom is that the user can do anything in the
> closure.
Right, that is a good plus compared to alternatives. :)
Regards,
Onur
Powered by blists - more mailing lists