Reputation: 5552
What advantages do I have from making my own TimerQueue
by calling CreateTimerQueue
and using it rather than just calling CreateTimerQueueTimer
with a NULL
value for TimerQueue
and thus using the default one? I understand that if I use my own I can delete all the timers at once by deleting the queue. I can hardly imagine that this is the only advantage, what am I missing?
Upvotes: 3
Views: 337
Reputation: 5552
First thanks to HerrJoebob and Raymond Chen for their quality comments. I did not originally intend to answer my own question.
Reason 1: someone else deleting all timers in the default queue (thanks to HerrJoebob)
Reason 2: someone else putting a 'bajillion' (slang for very many) timers in the default queue and starving yours (thanks to Raymond Chen)
Reason 3: using the flag WT_EXECUTEINTIMERTHREAD
saves a context switch when executing the callback, however if the callback takes a while it delays other timers. Using your own TimerQueue means you have your own timer thread so no one else can delay your timers and you can't inadvertently delay someone else's.
Upvotes: 2