mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] tools/nolibc: Implement msleep()
Date: Wed, 12 May 2021 14:50:00 +0200	[thread overview]
Message-ID: <20210512125000.GB20883@1wt.eu> (raw)
In-Reply-To: <20210512121858.GA6343@sirena.org.uk>

On Wed, May 12, 2021 at 01:18:58PM +0100, Mark Brown wrote:
> On Wed, May 12, 2021 at 01:59:49PM +0200, Willy Tarreau wrote:
> > On Wed, May 12, 2021 at 12:47:28PM +0100, Mark Brown wrote:
> 
> > >  - Return the number of seconds remaining if the delay does not
> > >    complete.
> 
> > But why returning the number of seconds instead of milliseconds ?
> > The common use case is this:
> 
> >      delay = delay_before_next_event();
> >      while ((ret = msleep(delay)) > 0)
> >             delay -= ret;
> 
> It seemed to be what you were asking for and I didn't have strong enough
> opinions for it to be worth pushing back.

Sorry if I wasn't clear then, but I proposed this example which should
return the number of ms left:

        if (sys_select(0, 0, 0, 0, &my_timeval) < 0)
                return my_timeval.tv_sec * 1000 + (my_timeval.tv_usec + 999) / 1000;
        else
                return 0;

In any case all of this is not critical but I'm fairly convinced that
your addition is useful, especially if done like this, which is why I
was asking.

Willy

  reply	other threads:[~2021-05-12 12:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 11:47 Mark Brown
2021-05-12 11:59 ` Willy Tarreau
2021-05-12 12:18   ` Mark Brown
2021-05-12 12:50     ` Willy Tarreau [this message]
2021-05-12 12:58       ` Mark Brown

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=20210512125000.GB20883@1wt.eu \
    --to=w@1wt.eu \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®