struct

Crystal::EventLoop::Polling::Event

Inherits Crystal::PointerPairingHeap::Node / Crystal::PointerLinkedList::Node / Struct / Value / Object

Information about the event that a Fiber is waiting on.

The event can be waiting for IO with or without a timeout, or be a timed event such as sleep or a select timeout (without IO).

The events can be found in different queues, for example Timers and/or Waiters depending on their type.

Constructors

new(type : Type, fiber : Fiber, index : Crystal::EventLoop::Polling::Arena::Index | Nil = nil, timeout : Time::Span | Nil = nil)
Source

Instance methods

fiber

The Fiber that is waiting on the event and that the EventLoop shall resume.

Source
heap_child=(heap_child : Pointer(self))
heap_child?
heap_compare(other : Pointer(self)) : Bool

Compare self with other. For example:

Use < to create a min heap. Use > to create a max heap.

Source
heap_next=(heap_next : Pointer(self))
heap_next?
heap_previous=(heap_previous : Pointer(self))
heap_previous?
index

Arena index to access the associated PollDescriptor when processing an IO event. Nil for timed events (sleep, select timeout).

Source
index?

Arena index to access the associated PollDescriptor when processing an IO event. Nil for timed events (sleep, select timeout).

Source
next
next=(next __arg0 : Pointer(self))
previous
previous=(previous : Pointer(self))
timed_out!

Mark the IO event as timed out.

Source
timed_out?

True if an IO event has timed out (i.e. we're past #wake_at).

Source
type
Source
wake_at

The absolute time, against the monotonic clock, at which a timed event shall trigger. Nil for IO events without a timeout.

Source
wake_at=(wake_at : Time::Instant | Nil)

Manually set the absolute time (against the monotonic clock). This is meant for FiberEvent to set and cancel its inner sleep or select timeout; these objects are allocated once per Fiber.

NOTE: musn't be changed after registering the event into Timers!

Source
wake_at?

The absolute time, against the monotonic clock, at which a timed event shall trigger. Nil for IO events without a timeout.

Source

Nested types