🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
2 messages
2 total messages Started by Alberto Wed, 24 Jan 2007 00:21
Delays less than 1ms
#2646
Author: Alberto
Date: Wed, 24 Jan 2007 00:21
17 lines
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
Re: Delays less than 1ms
#2648
Author: Boba
Date: Wed, 24 Jan 2007 03:01
25 lines
1878 bytes
"Alberto" <dibene@usa.net> wrote in message
news:45b6a64d@newsgroups.borland.com...
> 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

Straight from "About Multimedia Timers":
"Multimedia timer services allow applications to schedule timer events
with the greatest resolution (or accuracy) possible for the hardware
platform. These multimedia timer services allow you to schedule timer
events at a higher resolution than other timer services." HTH    Boba
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads