KeXxxTimer Routines, KTIMER Objects, and DPCs
Starting with Windows 2000, a set of KeXxxTimer routines is available to manage timers. These routines use timer objects that are based on the KTIMER structure. To create a timer object, a driver first allocates storage for a KTIMER structure. Then the driver calls a routine such as KeInitializeTimer or KeInitializeTimerEx to initialize this structure.
A timer can be set to expire just once, or to expire repeatedly after a given interval. KeSetTimer always sets a timer that will expire just once. KeSetTimerEx accepts an optional Period parameter, which specifies a recurring timer interval.
An optional CustomTimerDpc routine (a type of deferred procedure call) can be associated with either a notification timer or a synchronization timer. This routine executes when the specified time interval expires. For more information, see Using Timer Objects.
A timer can be a notification timer or a synchronization timer.
When a notification timer is signaled, all waiting threads have their wait satisfied. The state of the timer remains signaled until it is explicitly reset.
When a synchronization timer expires, its state is set to Signaled until a single waiting thread is released. Then the timer is reset to the Not-Signaled state.
KeInitializeTimer always creates notification timers. KeInitializeTimerEx accepts a Type parameter, which can be NotificationTimer or SynchronizationTimer.
The following topics provide more information about timer objects and DPCs:
Registering and Queuing a CustomTimerDpc Routine