Documentation
¶
Overview ¶
Package timing provides a demand-driven Hashed Timing Wheel for tracking millions of short-lived timeouts without allocating OS timers.
Concurrency model: Wheel is not thread-safe and must be driven from a single goroutine (e.g., the main game loop).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TimerID ¶
type TimerID uint64
TimerID uniquely identifies a scheduled timer for O(1) cancellation. Upper 32 bits = epoch (generation), Lower 32 bits = slot index.
type Wheel ¶
type Wheel struct {
// contains filtered or unexported fields
}
Wheel is an O(1) hashed timing wheel. It is demand-driven: the caller pumps it by calling Advance(dt).
func New ¶
New creates a timing wheel with the given resolution (tick size). nodeCapacity pre-allocates the fixed-size node pool.
Click to show internal directories.
Click to hide internal directories.