class Async::Wrapper
@deprecated With no replacement. Prefer native interfaces.
Represents an asynchronous IO within a reactor.
def close
Close the io and monitor.
def close @io.close end
def closed?
def closed? @io.closed? end
def dup
def dup self.class.new(@io.dup) end
def initialize(io, reactor = nil)
@parameter reactor [Reactor] the reactor that is managing this wrapper, or not specified, it’s looked up by way of {Task.current}.
@parameter io the native object to wrap.
def initialize(io, reactor = nil) @io = io @reactor = reactor @timeout = nil end
def wait_any(timeout = @timeout)
@parameter duration [Float] timeout after the given duration if not ‘nil`.
Wait fo the io to become either readable or writable.
def wait_any(timeout = @timeout) @io.to_io.wait(::IO::READABLE|::IO::WRITABLE|::IO::PRIORITY, timeout) or raise TimeoutError end
def wait_priority(timeout = @timeout)
Wait for the io to become writable.
def wait_priority(timeout = @timeout) @io.to_io.wait_priority(timeout) or raise TimeoutError end
def wait_readable(timeout = @timeout)
Wait for the io to become readable.
def wait_readable(timeout = @timeout) @io.to_io.wait_readable(timeout) or raise TimeoutError end
def wait_writable(timeout = @timeout)
Wait for the io to become writable.
def wait_writable(timeout = @timeout) @io.to_io.wait_writable(timeout) or raise TimeoutError end