LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jan Engelhardt <jengelh@linux01.gwdg.de>
To: "Sindre Aamås" <aamas@stud.ntnu.no>
Cc: linux-kernel@vger.kernel.org
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: <20070224215403.ka5imjqjo08cko0c@webmail.ntnu.no>


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
http://ttyrpld.svn.sf.net/viewvc/*checkout*/ttyrpld/trunk/user/replay.c


Jan
-- 
ft: http://freshmeat.net/p/chaostables/

      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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* 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 \
    --to=jengelh@linux01.gwdg.de \
    --cc=aamas@stud.ntnu.no \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: Correct way for an application to sleep?' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).