Skip to content

Commit

Permalink
Async::IO::CZTopSocket: speed up #wait_readable and #wait_writable
Browse files Browse the repository at this point in the history
  • Loading branch information
paddor committed Jan 4, 2024
1 parent 710d86b commit 02c20b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/cztop/async.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit 02c20b7

Please sign in to comment.