module Async

Classes and Modules

class Barrier

A general purpose synchronisation primitive, which allows one task to wait for a number of other tasks to complete. It can be used in conjunction with class Async::Semaphore.

class Cancel < Exception

Raised when a task is explicitly cancelled.

class Clock

A convenient wrapper around the internal monotonic clock.

class Condition

A synchronization primitive, which allows fibers to wait until a particular condition is (edge) triggered.

module Console

Shims for the console gem, redirecting warnings and above to Kernel#warn.

class Deadline

Represents a deadline timeout with decrementing remaining time. Includes an efficient representation for zero (non-blocking) timeouts.

class TimeoutError < StandardError

Raised if a timeout occurs on a specific Fiber. Handled gracefully by Task.

module ForkHandler

Private module that hooks into Process._fork to handle fork events.

class Idler

A load balancing mechanism that can be used process work when the system is idle.

class LimitedQueue < Queue

A thread-safe queue which limits the number of items that can be enqueued.

class List

A general doublely linked list. This is used internally by class Async::Barrier and class Async::Condition to manage child tasks.

module Loop
class Children < List

A list of children tasks.

class Node

A node in a tree, used for implementing the task hierarchy.

class Notification < Condition

A synchronization primitive, which allows fibers to wait until a notification is received. Does not block the task which signals the notification. Waiting tasks are resumed on next iteration of the reactor.

class PriorityQueue

A queue which allows items to be processed in priority order of consumers.

class Promise

A promise represents a value that will be available in the future. Unlike Condition, once resolved (or rejected), all future waits return immediately with the stored value or raise the stored exception.

class Queue

A thread-safe queue which allows items to be processed in order.

class Reactor < Scheduler

A wrapper around the the scheduler which binds it to the current thread automatically.

class Scheduler < Node

Handles scheduling of fibers. Implements the fiber scheduler interface.

class Semaphore

A synchronization primitive, which limits access to a given resource.

class Task < Node

Represents a sequential unit of work, defined by a block, which is executed concurrently with other tasks. A task can be in one of the following states: initialized, running, completed, failed, or cancelled.

class Timeout

Represents a flexible timeout that can be rescheduled or extended.

class Variable

A synchronization primitive that allows one task to wait for another task to resolve a value.

class Waiter

A composable synchronization primitive, which allows one task to wait for a number of other tasks to complete. It can be used in conjunction with class Async::Semaphore and/or class Async::Barrier.