What is the best algorithm for implementing a simple timer library. The library must allow the following:
- Triggered timers
- Timers to Stop
- Timers to be checked whether they will be executed
Enabling the timer by the timer will call the callback function.
The timer module will allow timers to have Ns time resolution, and each Ns must be assigned to the module in order to cause the module to check expired timers.
Many timers can be simultaneously active.
A better algorithm should meet the following goals
- Be reliable to start / stop timers when handling a timer expiration callback
- Allow start, stop and check timers quickly
- We have a small amount of memory
Hi
algorithm timer
Howard may
source share