Clocks and Timers
Real-time systems require a number of operating system timing services. The operating system must be able to keep an accurate accounting of the passage of time, schedule threads at precise times, and suspend threads for precise intervals.
The RTX64 clock and timer facilities provide the services necessary for threads to perform periodic tasks that correspond with the external passage of time.
- An RTX64 clock is a counter of a specified interval that measures the passage of time.
- An RTX64 timer is an implicit handling thread that receives notification from RTSS of a timer expiration and calls the handling routine specified when the timer was created.
Timers are associated with a clock in the system - against which a timer's expiration is measured - when they are created. A timer begins to count down to its expiration after having been set. Once the timer has expired, the handling thread is executed and the timer is automatically rearmed if necessary. A Timer can be set to execute its handling routine only once and is referred to as a “one-shot” timer, or it can be set to execute its handling routine on an ongoing periodic basis, which is referred to as a "repeat" or "interval" timer.
NOTE: Timer periods must be set to a multiple of the value that the HAL timer period is set to in the RTX64 Control Panel.
In addition to clocks and timers, RTX64 provides sleep services that let you suspend the current thread for a specified period of time.