class
Termisu::Event::Poller::Poll
- Termisu::Event::Poller::Poll
- Termisu::Event::Poller
- Reference
- Object
Defined in:
termisu/event/poller/poll.crConstant Summary
-
Log =
Termisu::Logs::Event
Constructors
Instance Method Summary
-
#add_timer(interval : Time::Span, repeating : Bool = true) : TimerHandle
Creates a new timer with the specified interval.
-
#close : Nil
Releases all resources held by the poller.
-
#modify_timer(handle : TimerHandle, interval : Time::Span) : Nil
Modifies an existing timer's interval.
-
#register_fd(fd : Int32, events : FDEvents) : Nil
Registers a file descriptor for event monitoring.
-
#remove_timer(handle : TimerHandle) : Nil
Removes a timer.
-
#unregister_fd(fd : Int32) : Nil
Unregisters a file descriptor from event monitoring.
-
#wait(timeout : Time::Span) : PollResult | Nil
Waits for an event with timeout.
-
#wait : PollResult | Nil
Waits indefinitely for an event.
Instance methods inherited from class Termisu::Event::Poller
add_timer(interval : Time::Span, repeating : Bool = true) : TimerHandle
add_timer,
close : Nil
close,
modify_timer(handle : TimerHandle, interval : Time::Span) : Nil
modify_timer,
register_fd(fd : Int32, events : FDEvents) : Nil
register_fd,
remove_timer(handle : TimerHandle) : Nil
remove_timer,
unregister_fd(fd : Int32) : Nil
unregister_fd,
wait(timeout : Time::Span) : PollResult | Nilwait : PollResult | Nil wait
Constructor methods inherited from class Termisu::Event::Poller
create : Poller
create
Constructor Detail
Instance Method Detail
Creates a new timer with the specified interval.
interval- Time between timer expirationsrepeating- If true, timer auto-rearms; if false, fires once
Returns a TimerHandle for later modification or removal.
Raises IO::Error on system error.
Releases all resources held by the poller.
Closes internal file descriptors and clears timer state. Safe to call multiple times (idempotent).
Modifies an existing timer's interval.
handle- Timer to modifyinterval- New interval
Raises ArgumentError if handle is invalid.
Registers a file descriptor for event monitoring.
fd- File descriptor to monitorevents- Event types to monitor (read, write, error)
Raises IO::Error on system error.
Removes a timer.
Safe to call with already-removed handle (no-op).
Unregisters a file descriptor from event monitoring.
Safe to call with unregistered fd (no-op).
Waits for an event with timeout.
Returns nil if timeout expires without an event.
Handles EINTR internally by retrying.
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.