diff options
author | Miklós Fazekas <mfazekas@szemafor.com> | 2016-03-26 11:11:35 +0100 |
---|---|---|
committer | Miklós Fazekas <mfazekas@szemafor.com> | 2016-03-26 11:11:35 +0100 |
commit | b82d4e965fdcd6d011b49ea7b2bdb0d285b62a63 (patch) | |
tree | ea44d20d6acf75a709b384198fbfcd81c6ac5e95 /lib/net/ssh/ruby_compat.rb | |
parent | 9f505d9f04c692d8e443912ed4a6b0fcc95619db (diff) | |
parent | c1714d7512514fd2a09c9c7931451cd5ab1f159a (diff) | |
download | net-ssh-4.0.0.alpha2.tar.gz |
Merge pull request #340 from mfazekas/close-chns-on-tr-closev4.0.0.alpha2
Close channels if trasport closed
Diffstat (limited to 'lib/net/ssh/ruby_compat.rb')
-rw-r--r-- | lib/net/ssh/ruby_compat.rb | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/lib/net/ssh/ruby_compat.rb b/lib/net/ssh/ruby_compat.rb index 2e9ef4f..d4abeb4 100644 --- a/lib/net/ssh/ruby_compat.rb +++ b/lib/net/ssh/ruby_compat.rb @@ -16,31 +16,9 @@ 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 + def self.io_select(*params) + IO.select(*params) end - end end; end |