3.7 Timer Objects with Associated DPCs

Any NT driver can have one or more IoTimer or CustomTimerDpc routines to be called periodically for whatever purpose the driver writer decides. Each of these types of standard driver routines is actually a DPC (see Section 3.6), queued for execution after some number of clock interrupts have been handled by the system.

The NT Kernel defines the timer object type, and the I/O Manager sets up a timer object that can be associated with each driver-created device object to provide support for drivers' IoTimer routines. At the driver writer's discretion, an NT driver can have a separate IoTimer routine for each device object that the driver creates. For more information about creating device objects, see Section 3.2.

An IoTimer routine is called once per second after the driver enables the timer until the driver disables the timer. The I/O Manager provides support routines for registering an IoTimer routine with a given device object and for enabling and disabling such a timer.

As an alternative, an NT driver can have one or more CustomTimerDpc routines that can be called at finer-grained, driver-determined intervals. The Kernel provides support routines for registering a CustomTimerDpc routine and for queueing the CustomTimerDpc to be called after a given timer interval has expired.

The following subsection explains how to set up an IoTimer routine and enable the timer. Section 3.7.2 explains how to register a CustomTimerDpc routine and how to queue this routine to be called after setting a timer interval.