LKML Archive on
help / color / mirror / Atom feed
From: Jan Engelhardt <>
To: "Sindre Aamås" <>
Subject: Re: Correct way for an application to sleep?
Date: Fri, 2 Mar 2007 02:43:41 +0100 (MET)	[thread overview]
Message-ID: <Pine.LNX.4.61.0702251411320.8734@yvahk01.tjqt.qr> (raw)
In-Reply-To: <>

On Feb 24 2007 21:54, Sindre Aamås wrote:
>Without root-privilegies, that leaves general purpose sleep functions  
>like nanosleep afaik. The problem is that the granularity of these  
>seems very unpredictable, and if I am to use a lowest common  
>denominator I'd only be able to sleep like 10 ms pr 16.7 ms on fast  
>systems, and not at all on not so fast systems. So, I'd like to know  
>what the "correct" way to handle this kind of situation is, if any,  
>from a kernel perspective. Is the only sensible thing to do to give a  
>user settable preference, deciding on a compromise default (or one  
>that says "screw you old kernels")?

You could use an adaptive sleeping ('overhead-corrected'), but I do not 
know how well it works with asynchronous events (such as audio output).
Take a look at the usleep_ovcorr() function in*checkout*/ttyrpld/trunk/user/replay.c


      reply	other threads:[~2007-03-02  1:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-24 20:54 Sindre Aamås
2007-03-02  1:43 ` Jan Engelhardt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0702251411320.8734@yvahk01.tjqt.qr \ \ \ \
    --subject='Re: Correct way for an application to sleep?' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).