Crystal::EventLoop::Timers(T)
List of Pointer(T) to T structs.
Internally wraps a PointerPairingHeap(T) and thus requires that T
implements PointerPairingHeap::Node.
Thread unsafe: parallel accesses must be protected!
NOTE: this is a struct because it only wraps a const pointer to an object allocated in the heap.
Constructors
new
SourceInstance methods
Add a new timer into the list. Returns true if it is the next ready timer.
Remove a timer from the list. Returns a tuple(dequeued, was_next_ready) of booleans. The first bool tells whether the event was dequeued, in which case the second one tells if it was the next ready event.
dequeue_ready
Dequeues and yields each ready timer (their #wake_at is lower than
Crystal::System::Time.instant) from the oldest to the most recent (i.e. time
ascending).
empty?
Source