eve.core.timer

Types 2

Hierarchical timing wheel for efficient timer management.

  • O(1) insert, O(1) cancel, O(1) amortized expiration check.
  • Granularity: 1ms (tick).
  • Range: ~18 hours (4 levels).
  • No dynamic allocations (uses pre-allocated entries from watcher slots).
Fields
TICK_MSInitial tick duration (base granularity).
LEVEL0_BITSLevel 0 configuration (256 slots).
LEVEL0_SIZE
LEVEL0_MASK
LEVELN_BITSHigher levels configuration (64 slots each).
LEVELN_SIZE
LEVELN_MASK
NUM_LEVELSTotal number of levels.
TOTAL_SLOTSTotal number of slots across all levels.
Methods
size_t count() @property const pure @safe nothrow @nogcReturn the total number of active timers in the wheel.
void reset(long initialTick = 0) @safe nothrow @nogcReset the wheel to its initial state.
void schedule(long delayMs, Entry * entry) @safe nothrow @nogcSchedule a timer entry in the appropriate level and slot.
void cancel(Entry * entry) @safe nothrow @nogcRemove a timer entry from its current slot.
Entry * tick() @trusted nothrow @nogcAdvance the wheel and collect all expired entries.
int nextDeadlineMs() const pure @safe nothrow @nogcReturn the number of milliseconds until the next timer is scheduled to fire.
long currentTick() @property const pure @safe nothrow @nogcReport the current monotonic tick counter.
Nested Templates
EntryIntrusive node for the timing wheel's linked lists.
SlotA slot in the wheel — head and tail of a doubly-linked list of entries.
SlotInfo
structTimerSpec

Declarative timer configuration stored by the loop.

Fields
long delayMsInitial delay before the first firing, in milliseconds.
long intervalMsRepeating interval in milliseconds. `0` means one-shot.
Methods
bool repeating() @property const pure @safe nothrow @nogcReport whether the timer repeats after the first firing.

Functions 2

fnlong normalizedDelay(long value) pure @safe nothrow @nogcClamp a requested timer delay to the non-negative range accepted by the loop.
fnlong normalizedInterval(long value) pure @safe nothrow @nogcClamp a requested timer interval to the non-negative range accepted by the loop.