What exactly does the msWindowLength parameter to SetThreadpoolTimer mean?

Raymond Chen

A customer was looking for clarification on the msWindow­Length parameter to the Set­Threadpool­Timer function.

msWindowLength [in, optional]

The maximum amount of time the system can delay before calling the timer callback. If this parameter is set, the system can batch calls to conserve power.

“It’s not clear whether the window extends both before and after the due time (presumably, half the window size on either side), or whether the timer will always delay at least until the due time, and possibly up to the due time plus the window value.”

The window specifies the maximum delay, and generally speaking, delay means late, never early. (When was the last time you heard that your flight was delayed, by which they meant that it landed 30 minutues early?)

In other words, the latter interpretation is the correct one. The threadpool will schedule the callback at some point between the due time and the due time plus the window.

(For the record, the Set­Coalescable­Timer and Set­Waitable­Timer­Ex functions work the same way.)

The customer thanked us for the clarification. That’s what they thought, but they wanted to make sure.


Discussion is closed.

Feedback usabilla icon