rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: Benno Lossin <benno.lossin@proton.me>
Cc: "Tiago Lam" <tiagolam@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>, "Will Deacon" <will@kernel.org>,
	"Waiman Long" <longman@redhat.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] rust: sync: add `CondVar::wait_timeout`
Date: Tue, 12 Dec 2023 10:45:41 +0100	[thread overview]
Message-ID: <CAH5fLghuRjZHg3BgowvDiAez3ukhm7PEegRB5G9ZbwSCXfAHVw@mail.gmail.com> (raw)
In-Reply-To: <F8K3EZWwaRdB3qwYwk7P9GGQUc83MNW4XLeqRHj6QsA6WtCtpweykXLuM5sj2RbpRu3y3OoFy6gmCtaV2tBA1sxGFeieUnTdaY2yGVSCXQ4=@proton.me>

On Fri, Dec 8, 2023 at 10:27 AM Benno Lossin <benno.lossin@proton.me> wrote:
>
> On 12/8/23 08:37, Alice Ryhl wrote:
> > On Wed, Dec 6, 2023 at 6:05 PM Tiago Lam <tiagolam@gmail.com> wrote:
> >> On 06/12/2023 10:09, Alice Ryhl wrote:
> >>> +/// The return type of `wait_timeout`.
> >>> +pub enum CondVarTimeoutResult {
> >>> +    /// The timeout was reached.
> >>> +    Timeout,
> >>> +    /// Somebody woke us up.
> >>> +    Woken {
> >>> +        /// Remaining sleep duration.
> >>> +        jiffies: u64,
> >>> +    },
> >>> +    /// A signal occurred.
> >>> +    Signal {
> >>> +        /// Remaining sleep duration.
> >>> +        jiffies: u64,
> >>> +    },
> >>> +}
> >>
> >> Is `Signal` and `Woken` only going to hold a single value? Would it be
> >> best represented as a tuple struct instead, like so?
> >>
> >>      pub enum CondVarTimeoutResult {
> >>          /// The timeout was reached.
> >>          Timeout,
> >>          /// Somebody woke us up.
> >>          Woken (u64),
> >>          /// A signal occurred.
> >>          Signal (u64),
> >>      }
> >
> > I could do that, but I like the explicitly named version as it makes
> > it clear that the unit is jiffies.
>
> Why not use `type Jiffies = u64;` until we have proper bindings for
> them? That way we can have both.

I do not mind adding and using a type alias, but I still think the
named fields are better.

Alice

  reply	other threads:[~2023-12-12  9:45 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 10:09 [PATCH 0/2] Additional CondVar methods needed by Rust Binder Alice Ryhl
2023-12-06 10:09 ` [PATCH 1/2] rust: sync: add `CondVar::notify_sync` Alice Ryhl
2023-12-06 15:49   ` Martin Rodriguez Reboredo
2023-12-07 20:21   ` Benno Lossin
2023-12-08  7:29     ` Alice Ryhl
2023-12-08  9:30       ` Benno Lossin
2023-12-06 10:09 ` [PATCH 2/2] rust: sync: add `CondVar::wait_timeout` Alice Ryhl
2023-12-06 15:53   ` Martin Rodriguez Reboredo
2023-12-06 16:38     ` Alice Ryhl
2023-12-06 16:30   ` Boqun Feng
2023-12-06 16:39     ` Peter Zijlstra
2023-12-06 16:42       ` Alice Ryhl
2023-12-06 16:53         ` Peter Zijlstra
2023-12-06 17:00           ` Alice Ryhl
2023-12-06 17:05   ` Tiago Lam
2023-12-08  7:37     ` Alice Ryhl
2023-12-08  9:27       ` Benno Lossin
2023-12-12  9:45         ` Alice Ryhl [this message]
2023-12-14 19:58       ` Boqun Feng
2023-12-14 20:04         ` [PATCH] rust: sync: Makes `CondVar::wait()` an uninterruptible wait Boqun Feng
2023-12-15 10:27           ` Alice Ryhl
2023-12-15 23:45             ` Boqun Feng
2023-12-18 17:39               ` Benno Lossin
2023-12-18 20:57                 ` Boqun Feng
2023-12-15 11:58           ` Tiago Lam
2023-12-20 11:11           ` Benno Lossin
2023-12-21 21:43           ` Miguel Ojeda
2023-12-08 19:04   ` [PATCH 2/2] rust: sync: add `CondVar::wait_timeout` Benno Lossin
2023-12-12  9:51     ` Alice Ryhl
2023-12-12 17:05       ` Benno Lossin

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=CAH5fLghuRjZHg3BgowvDiAez3ukhm7PEegRB5G9ZbwSCXfAHVw@mail.gmail.com \
    --to=aliceryhl@google.com \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tiagolam@gmail.com \
    --cc=wedsonaf@gmail.com \
    --cc=will@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).