struct

Crystal::EventLoop::Polling::Waiters

Inherits Struct / Value / Object

A FIFO queue of Event waiting on the same operation (either read or write) for a fd. See PollDescriptor.

Race conditions on the state of the waiting list are handled through the ready always ready variables.

Thread unsafe: parallel mutations must be protected with a lock.

Constructors

Instance methods

add(event : Pointer(Event)) : Bool

Adds an event to the waiting list. May return false immediately if another thread marked the list as ready in parallel, returns true otherwise.

Source
delete(event : Pointer(Event)) : Nil
Source
initialize
Source
ready_all

Dequeues all pending events and marks the list as always ready. This must be called when a fd is closed or an error or hup event occurred.

Source
ready_one

Removes one pending event or marks the list as ready when there are no pending events (we got notified of readiness before a thread enqueued).

Source