Platform SDK: DLLs, Processes, and Threads |
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.
A timer-queue timer is set to the signaled state when its specified due time arrives. Any thread with a handle to the timer can use one of the wait functions to wait for the timer state to be set to signaled.
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.