Article View: borland.public.cppbuilder.nativeapi
Article #11178Re: Finegrain Sleep
From: Graham Reeds
Date: Thu, 19 Feb 2004 11:16
Date: Thu, 19 Feb 2004 11:16
25 lines
2030 bytes
2030 bytes
"Steve Aletto" <steve_alettoNOSPAM@THANKShotmail.com> wrote in message news:40336c3f@newsgroups.borland.com... > > I need a sleep function with a finer grain than a millisecond. > Hardly you'll find it. Windows isn't real-time at all and the best timers I > know are multimedia timers. You can have a look at them. Have also a look at > GetTickCount, QueryPerformaceCounter and associates. It's not a timer, just a sleep function, though I suppose I could have a state machine, but that runs the risk of missing incoming data. Have to see how that one would work... > > The reason is I am porting a Unix application that has the usleep function > > which takes an argument in microseconds. > The argument could be even in microseconds, but is the pause so accurate as > well? I wouldn't bet on that. What the Unix program does wait for some data in one thread and write in another. We now need to link it to another piece of hardware and they only write Windows drivers - hence the port. The Unix prog works fine, but the Windoze version is sleeping too long. Even Sleep(0) takes around 20ms.
Technical Details
Message-ID:
<40349ac7@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4033629c$1@newsgroups.borland.com> <40336c3f@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 03:34:27 PST From: "Graham Reeds" <grahamr@omnieng.co.uk> Newsgroups: borland.public.cppbuilder.nativeapi References: <4033629c$1@newsgroups.borland.com> <40336c3f@newsgroups.borland.com> Subject: Re: Finegrain Sleep Date: Thu, 19 Feb 2004 11:16:03 -0000 Lines: 27 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: 193.82.59.1 Message-ID: <40349ac7@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1077189319 193.82.59.1 (19 Feb 2004 03:15:19 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail