class

Termisu::Event::Poller::Linux

Inherits Termisu::Event::Poller / Reference / Object

Constants

Log = Termisu::Logs::Event

Constructors

Instance methods

add_timer(interval : Time::Span, repeating : Bool = true) : TimerHandle

Creates a new timer with the specified interval.

  • interval - Time between timer expirations
  • repeating - If true, timer auto-rearms; if false, fires once

Returns a TimerHandle for later modification or removal. Raises IO::Error on system error.

Source
close

Releases all resources held by the poller.

Closes internal file descriptors and clears timer state. Safe to call multiple times (idempotent).

Source
modify_timer(handle : TimerHandle, interval : Time::Span) : Nil

Modifies an existing timer's interval.

  • handle - Timer to modify
  • interval - New interval

Raises ArgumentError if handle is invalid.

Source
register_fd(fd : Int32, events : FDEvents) : Nil

Registers a file descriptor for event monitoring.

  • fd - File descriptor to monitor
  • events - Event types to monitor (read, write, error)

Raises IO::Error on system error.

Source
remove_timer(handle : TimerHandle) : Nil

Removes a timer.

Safe to call with already-removed handle (no-op).

Source
unregister_fd(fd : Int32) : Nil

Unregisters a file descriptor from event monitoring.

Safe to call with unregistered fd (no-op).

Source
wait(timeout : Time::Span) : PollResult | Nil

Waits for an event with timeout.

Returns nil if timeout expires without an event. Handles EINTR internally by retrying.

Source
wait

Waits indefinitely for an event.

Blocks until an event occurs. Returns nil if the poller is closed or interrupted in a way that signals shutdown.

Handles EINTR internally by retrying.

Source