Timer Queues

The CreateTimerQueue function creates a queue for timers. Timers in this queue, known as timer-queue timers, are lightweight objects that enable you to specify a callback function to be called when the specified due time arrives. The wait operation is performed by a thread in the thread pool.

To add a timer to the queue, call the CreateTimerQueueTimer function. To update a timer-queue timer, call the ChangeTimerQueueTimer function. You can specify a callback function to be executed by a worker thread from the thread pool when the timer expires.

To cancel a pending timer, call the DeleteTimerQueueTimer function. When you are finished with the queue of timers, call the DeleteTimerQueueEx function to delete the timer queue. Any pending timers in the queue are canceled and deleted.

Using Timer Queues