Re: Best option for 'idle wait'
From: poltrone (nospam_at_nospam.net)
Date: 07/29/04
- Next message: Arkady Frenkel: "Re: SERVICE_CONTROL_STOP not received"
- Previous message: Arkady Frenkel: "Re: AWE sample cannot be compiled."
- In reply to: Harshal: "Best option for 'idle wait'"
- Next in thread: Harshal: "Re: Best option for 'idle wait'"
- Reply: Harshal: "Re: Best option for 'idle wait'"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 29 Jul 2004 09:06:00 +0200
AFAIK there is only one mechanism in windows, that lets you time operations
with a higher resolution than several milliseconds (without busy waiting)
and that's the multimedia timer (timeSetEvent()). But such a timer doesn't
block one of your threads, but creates a new one, which in turn will call
a function that you supply after some time. Maybe you can change your code
to work that way.
Ciao,
poltrone
"Harshal" <mumbaiyaa@yahoo.com> schrieb im Newsbeitrag
news:9f8e33a7.0407281300.da1ca8f@posting.google.com...
> Hello,
>
> I am trying to find the best way to wait for a specific time-period
> inside a loop. I want to wait for some time between each execution of
> the loop. The problem is that the wait period is less than 1
> millisecond (typically a few hundred micro-seconds) and so I can't
> depend on Sleep() or even on waitable timers. I am currently using a
> 'for' loop as a delay loop but this 'busy wait' consumes a lot of CPU
> cycles and I can't do much else while I am waiting. Are there other
> ways of waiting for sub-millisecond periods?
>
> I know that Windows is not a real-time OS so I won't be able to get
> very accurate microsecond-level timing. But I would settle for a
> variation of tens of microseconds if I could do it without tying up
> the CPU.
>
> Thanks for any pointers.
>
> Regards,
> Harshal
- Next message: Arkady Frenkel: "Re: SERVICE_CONTROL_STOP not received"
- Previous message: Arkady Frenkel: "Re: AWE sample cannot be compiled."
- In reply to: Harshal: "Best option for 'idle wait'"
- Next in thread: Harshal: "Re: Best option for 'idle wait'"
- Reply: Harshal: "Re: Best option for 'idle wait'"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|