lkml.org 
[lkml]   [2003]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Runaway cron task on 2.5.63/4 bk?

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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.052 / U:30.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site