Sha256: 7fe7d5d60258e1241636c1145da1dd00a6b244d6acf58a5bf7d7a095947cf837

Contents?: true

Size: 1.19 KB

Versions: 119

Compression:

Stored size: 1.19 KB

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 certain versions of MRI 1.8.
    # See: http://net-ssh.lighthouseapp.com/projects/36253/tickets/1-ioselect-threading-bug-in-ruby-18
    # The root issue is documented here: 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)
        # It should be safe to wrap calls in a mutex when the timeout is 0
        # (that is, the call is not supposed to block).
        # We leave blocking calls unprotected to avoid causing deadlocks.
        # This should still catch the main case for Capistrano users.
        if params[3] == 0
          SELECT_MUTEX.synchronize do
            IO.select(*params)
          end
        else
          IO.select(*params)
        end
      end
    end
    
  end
  
end; end

Version data entries

119 entries across 89 versions & 12 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/net-ssh-2.4.0/lib/net/ssh/ruby_compat.rb
tpkg-2.3.5 lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/ruby_compat.rb
tpkg-2.3.4 lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/ruby_compat.rb
jayniz-net-ssh-2.0.15 lib/net/ssh/ruby_compat.rb
depengine-0.0.31 etc/isolate/ruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.31 etc/isolate/jruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.30 etc/isolate/jruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.30 etc/isolate/ruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.29 etc/isolate/ruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.29 etc/isolate/jruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.28 etc/isolate/jruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.28 etc/isolate/ruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.27 etc/isolate/jruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.27 etc/isolate/ruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.26 etc/isolate/ruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.26 etc/isolate/jruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.25 etc/isolate/jruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.25 etc/isolate/ruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.24 etc/isolate/ruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb
depengine-0.0.24 etc/isolate/jruby-1.8/gems/net-ssh-2.0.23/lib/net/ssh/ruby_compat.rb