in reply to Accurately timed reccuring events

If it's that critical, you might be on the wrong platform. Perhaps you should investigate a Real Time Operating System, such as RTLinux or QNX.

No matter how fancy you get with your scheduling, there's no guarantee with an ordinary OS that your event will not be preempted by some other system event.

Matt

Replies are listed 'Best First'.
Re: Re: Accurately timed reccuring events
by aquarium (Curate) on Mar 24, 2003 at 03:16 UTC
    Either you use a module with alarm functionality (which polls the time for you) or you poll the clock yourself...then DO_EVENTS so the system can do stuff...then poll again to see if current_time - last_event_time >= period. If you want this code to be "fairly" reliable in timing, make it a service with the win32 service module. But even a service can be delayed for a long time, eg system decides to increase size of swap file etc. If you want guaranteed n calls to periodic_procedure for n seconds with little or no latency, then Real Time OS to start with is your only option in my opinion. Chris