[前][次][番号順一覧][スレッド一覧]

ruby-changes:71053

From: Samuel <ko1@a...>
Date: Mon, 31 Jan 2022 15:36:18 +0900 (JST)
Subject: [ruby-changes:71053] 5b0c7b4ad0 (ruby_3_1): Prefer `wait_readable` rather than `IO.select`.

https://git.ruby-lang.org/ruby.git/commit/?id=5b0c7b4ad0

From 5b0c7b4ad00cd2ada282ea1aa03f0c1a75b0df77 Mon Sep 17 00:00:00 2001
From: Samuel Williams <samuel.williams@o...>
Date: Mon, 27 Dec 2021 17:08:35 +1300
Subject: Prefer `wait_readable` rather than `IO.select`.

---
 lib/irb/input-method.rb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb
index f965290ac8e..64276e61be2 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -84,8 +84,7 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/input-method.rb#L84
     #
     # See IO#eof? for more information.
     def eof?
-      rs, = IO.select([@stdin], [], [], 0.00001)
-      if rs and rs[0]
+      if @stdin.wait_readable(0.00001)
         c = @stdin.getc
         result = c.nil? ? true : false
         @stdin.ungetc(c) unless c.nil?
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]