Re: Runaway cron task on 2.5.63/4 bk?

Linus Torvalds
2003-03-10T23:30:18Z

On Tue, 11 Mar 2003, Felipe Alfaro Solana wrote:
>
> why not sleep(0)?

I think a much more likely (and correct) usage for big sleep values is
more something like this:

do_with_timeout(xxx, int timeout)
{
struct timespec ts;

... set up some async event ..
ts.tv_nsec = 0;
ts.tv_sec = timeout;
while (nanosleep(&ts, &ts)) {
if (async event happened)
return happy;
}
.. tear down the async event if it didn't happen ..
}

and here the natural thing to do in user space is to just make the "no
timeout" case be a huge value.

At which point it is a _bug_ in the kernel if we return early with some
random error code.

Linus