Article View: borland.public.cppbuilder.nativeapi
Article #2646Delays less than 1ms
From: Alberto
Date: Wed, 24 Jan 2007 00:21
Date: Wed, 24 Jan 2007 00:21
17 lines
1386 bytes
1386 bytes
Hello all,
the Sleep(1) call puts the program in a hold status for at least 1ms
(nominal...).
I am interfacing some external hardware in my program, and I need to
insert a small delay between consecutive operations. But 1ms is too
much, the overall response time becomes too sluggish. I reckoned that 50
to 100 usec would do nicely.
Is there a simple way to do that ?
A possible solution could be to use the QueryPerformanceCounter API,
then do a spin loop waiting for 100 usec to be elapsed, but of course a
spin loop is a no-no in a multitasking system like Windows.
I am open to suggestions, thanks.
Alberto
Technical Details
Message-ID:
<45b6a64d@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f9da0ba2269a64ec,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 24 Jan 2007 01:21:10 +0100 From: Alberto <dibene@usa.net> User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Delays less than 1ms Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 151.46.154.32 Message-ID: <45b6a64d@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1169598029 151.46.154.32 (23 Jan 2007 16:20:29 -0800) Lines: 17 Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail