At 3:33 PM -0400 1999/07/14, Dave Lippincott wrote:
>If you do it this way, you will have to intercept *every* message generated
>by the OS. That will suck up allot of CPU time. Just look for the nilEvent
>message. When it is received, check the tick count or clock. If you set
>the EvtGetEvent timeout to some rate that is at least twice the required
>frequency, you will almost certainly get the desired timing period.
No, check the tick count at every event if you need to guarantee a specific frequency.
You'll burn more cycles halving the timeout frequency than you will performing a
simple "is it time now?" check on every received event.
A side effect of checking only during nil events is that the user may be entering data
or tapping the screen quickly, enqueueing each event within the timeout frequency,
thus starving your event loop of nil events.
Regards,
Jim Schram
3Com/Palm Computing
Partner Engineering