зеркало из https://github.com/github/ruby.git
[ruby/reline] Prefer wait_readable for fiber scheduler.
https://github.com/ruby/reline/commit/06b4aa31fd
This commit is contained in:
Родитель
c91fb5db59
Коммит
b5c4570af4
|
@ -142,7 +142,7 @@ class Reline::ANSI
|
|||
unless @@buf.empty?
|
||||
return @@buf.shift
|
||||
end
|
||||
until c = @@input.raw(intr: true) { select([@@input], [], [], 0.1) && @@input.getbyte }
|
||||
until c = @@input.raw(intr: true) { @@input.wait_readable(0.1) && @@input.getbyte }
|
||||
Reline.core.line_editor.resize
|
||||
end
|
||||
(c == 0x16 && @@input.raw(min: 0, tim: 0, &:getbyte)) || c
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require 'timeout'
|
||||
require 'io/wait'
|
||||
|
||||
class Reline::GeneralIO
|
||||
def self.reset(encoding: nil)
|
||||
|
@ -36,7 +37,7 @@ class Reline::GeneralIO
|
|||
end
|
||||
c = nil
|
||||
loop do
|
||||
result = select([@@input], [], [], 0.1)
|
||||
result = @@input.wait_readable(0.1)
|
||||
next if result.nil?
|
||||
c = @@input.read(1)
|
||||
break
|
||||
|
|
Загрузка…
Ссылка в новой задаче