SeptemberOS Software Timers

SeptemberOS provides installable software timers. Timers may be used by any code in the OS: application, system or driver. Application timers use main system timer interrupt and may be installed with timeout being any multiple of system timer tick.

Timers are called when their timeout value expires in context of system timer's interrupt. This way timers reporting presicion is fairly good, as it doesn't need a task switch, doesn't allow additional interrupts interfere with the timer handler's code and doesn't risk being preempted. However care should be taken in order to use only very short (time-wise) processing code, in particular not to overlap the next timer tick interrupt, as it may cause the system behave incorrectly (this particularly means using debug printouts to serial port from a timer handler ONLY in development/experimental code (taking into account that the system may misbehave) and NEVER in production code.

A timer may be installed as periodic (will auto-reinstall itself after being handled) or as one-shot (will be removed after being handled). If some condition changed, the timer may be canceled (and removed) at any time, including from within its own handler.

Copyright (c) Daniel Drubin, 2010