Re: Runaway cron task on 2.5.63/4 bk?

From: Linus Torvalds (torvalds@transmeta.com)
Date: Mon Mar 10 2003 - 18:33:37 EST


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/



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:23 EST