[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210512125000.GB20883@1wt.eu>
Date: Wed, 12 May 2021 14:50:00 +0200
From: Willy Tarreau <w@....eu>
To: Mark Brown <broonie@...nel.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] tools/nolibc: Implement msleep()
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
Powered by blists - more mailing lists