Sha256: b1c2f50637de4cfde3fdc8b67ec3e348c9ea50df5a56444a378a3f81a344b9af

Contents?: true

Size: 807 Bytes

Versions: 2

Compression:

Stored size: 807 Bytes

Contents

require 'thread'

class String
  if RUBY_VERSION < "1.9"
    def getbyte(index)
      self[index]
    end
  end
end

module Net; module SSH
  
  # This class contains miscellaneous patches and workarounds
  # for different ruby implementations.
  class Compat
    
    # A workaround for an IO#select threading bug in MRI 1.8.
    # See: http://net-ssh.lighthouseapp.com/projects/36253/tickets/1-ioselect-threading-bug-in-ruby-18
    # Also: http://redmine.ruby-lang.org/issues/show/1993
    if RUBY_VERSION >= '1.9' || RUBY_PLATFORM == 'java'
      def self.io_select(*params)
        IO.select(*params)
      end
    else
      SELECT_MUTEX = Mutex.new
      def self.io_select(*params)
        SELECT_MUTEX.synchronize do
          IO.select(*params)
        end
      end
    end
    
  end
  
end; end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
net-ssh-net-ssh-2.0.14 lib/net/ssh/ruby_compat.rb
net-ssh-2.0.14 lib/net/ssh/ruby_compat.rb