Article View: borland.public.cppbuilder.nativeapi
Article #11241Re: Finegrain Sleep
From: Benjamin Pratt
Date: Fri, 20 Feb 2004 19:23
Date: Fri, 20 Feb 2004 19:23
13 lines
1966 bytes
1966 bytes
> I'm currently trying out QueryPerformanceCounter() and having a state > machine to quickly switch between the states depending on the time. Seems > to be working, and doesn't use 3 threads (the GUI, data-in, data-out). This is probably you best bet, however, the thread can still be preempted by another thread or process and screw up the accuracy. If the state machine only runs for very short periods before changing states, you may want to consider increasing the priority class while in that loop. Process priority class = REALTIME_PRIORITY_CLASS and Thread priority = THREAD_PRIORITY_TIME_CRITICAL. However, you must use this very carefully. I would not suggest being in this mode for more than a few milliseconds. Unfortunately, there is nothing you can do about hardware interrupts, so the timestamp is always somewhat suspect.
Technical Details
Message-ID:
<40365e0f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4033629c$1@newsgroups.borland.com> <40336c3f@newsgroups.borland.com> <40349ac7@newsgroups.borland.com> <4034d0ba@newsgroups.borland.com> <4034ecd4$1@newsgroups.borland.com> <4035bee9@newsgroups.borland.com> <4035dd66@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,fed9196afef30d83 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-02-20 11:40:16 PST From: "Benjamin Pratt" <benjamin.pratt.getridofthis@verizon.net> Newsgroups: borland.public.cppbuilder.nativeapi References: <4033629c$1@newsgroups.borland.com> <40336c3f@newsgroups.borland.com> <40349ac7@newsgroups.borland.com> <4034d0ba@newsgroups.borland.com> <4034ecd4$1@newsgroups.borland.com> <4035bee9@newsgroups.borland.com> <4035dd66@newsgroups.borland.com> Subject: Re: Finegrain Sleep Date: Fri, 20 Feb 2004 11:23:05 -0800 Lines: 15 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 24.130.93.201 Message-ID: <40365e0f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1077304847 24.130.93.201 (20 Feb 2004 11:20:47 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail