diff --git a/lib/cztop/async.rb b/lib/cztop/async.rb index 1138a00..bed428a 100644 --- a/lib/cztop/async.rb +++ b/lib/cztop/async.rb @@ -49,6 +49,8 @@ def <<(...) def wait_readable(timeout = read_timeout) @io_fd ||= ::IO.for_fd @io.fd, autoclose: false + return true if @io.readable? + if timeout timeout_at = now + timeout @@ -67,6 +69,8 @@ def wait_readable(timeout = read_timeout) def wait_writable(timeout = write_timeout) @io_fd ||= ::IO.for_fd @io.fd, autoclose: false + return true if @io.writable? + if timeout timeout_at = now + timeout