Article View: borland.public.cppbuilder.nativeapi
Article #11183Re: Finegrain Sleep
From: Steve Aletto
Date: Thu, 19 Feb 2004 15:06
Date: Thu, 19 Feb 2004 15:06
16 lines
1642 bytes
1642 bytes
> It's not a timer, just a sleep function Sure, but you can easily create a sleep function with the functions I suggested, especially inside a thread. Here is a very simple (ugly and untested) example to wait 20ms.: DWORD t = GetTickCount(); while ((GetTickCount() - t) < 0.02); But I'm pretty sure you won't get a very precise pause as you can using a multimedia timer. Besides, your CPU would be quite busy. > Even Sleep(0) takes around 20ms. Correct remark. Again, have a look at multimedia timers. I don't know anything else more precise when you have to face "time" issues. Steve.
Technical Details
Message-ID:
<4034d0ba@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>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-19 07:10:57 PST Reply-To: "Steve Aletto" <steve_alettoNOSPAM@THANKShotmail.com> From: "Steve Aletto" <steve_alettoNOSPAM@THANKShotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4033629c$1@newsgroups.borland.com> <40336c3f@newsgroups.borland.com> <40349ac7@newsgroups.borland.com> Subject: Re: Finegrain Sleep Date: Thu, 19 Feb 2004 16:06:00 +0100 Lines: 18 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 80.105.101.132 Message-ID: <4034d0ba@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1077203130 80.105.101.132 (19 Feb 2004 07:05:30 -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