Article # 638, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
TIMER_EVENT_ONE_SHOT vs. TIMER_EVENT_CONTINUAL
Q. We were told to use lots of TIMER_EVENT_ONE_SHOT instead of one TIMER_EVENT_CONTINUAL. Why? I use a timer that updates seconds on-screen. If I used lots of ONE_SHOT timers instead of one CONTINUAL, wouldn't the timing get wrong? A. I think the concern here is that if the thread receiving the continual timer events blocks for a long period of time, a lot of events will get placed in the queue. When the thread continues processing, it will get bombarded with timer events, possibly causing problems with the logic of the program, or causing a lot of flickering updates or something. If you use one shot timers, you know that you are going to receive exactly one event. But you're right, you shouldn't use a series of one one-shots for precision timing. If you need to know the precise time when one of these events go off, query it from the system instead of counting timer events.