Sha256: c96c8a2c20edbab4b5ad97a9571542819dc15d4e978316caaff0c48d911a46f3

Contents?: true

Size: 451 Bytes

Versions: 2

Compression:

Stored size: 451 Bytes

Contents

# frozen_string_literal: true

require 'polyphony'

# readline blocks the current thread, so we offload it to the blocking-ops
# thread pool. That way, the reactor loop can keep running while waiting for
# readline to return
module ::Readline
  alias_method :orig_readline, :readline

  def readline(*args)
    async = Gyro::Async.new
    Thread.new do
      result = orig_readline(*args)
      async.signal!(result)
    end
    async.await
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
polyphony-0.30 lib/polyphony/irb.rb
polyphony-0.29 lib/polyphony/irb.rb