TimerState.computePollTimeout

int computePollTimeout(Slot)(int requestedTimeoutMs, const ref TimerWheel timerWheel, scope const(Slot)[] slots) const pure @safe nothrow @nogc

Compute the poll timeout considering timer deadlines and idle watchers.

Returns the most restrictive timeout between the requested timeout, the next timer deadline, and the presence of idle watchers.

Parameters

requestedTimeoutMsCaller-requested timeout in milliseconds.
timerWheelTimer wheel to check for next deadline.
slotsWatcher slot array to check for idle watchers.

Returns

The adjusted timeout in milliseconds, or 0 if idle watchers exist.