Re: [PATCH v2] tools/nolibc: Implement msleep()

From: Willy Tarreau
Date: Wed May 12 2021 - 07:59:56 EST


On Wed, May 12, 2021 at 12:47:28PM +0100, Mark Brown wrote:
> Allow users to implement shorter delays than a full second by implementing
> msleep().
>
> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
> ---
>
> v2:
> - Support delays of more than a second.
> - 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;

Willy