1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

stdlib: use IO#wait_*able instead of IO.select when possible

In case a process encounters high-numbered FDs, this allows
consistent performance on systems with ppoll support.
[ruby-core:35572]

* ext/socket/lib/socket.rb (connect_nonblock): use IO#wait_writable
* lib/drb/drb.rb (DRB::DRbTCPSocket#alive?): use IO#wait_readable
* lib/webrick/httpserver.rb (run): ditto
* lib/resolv.rb (request): ditto for single socket case
  [ruby-core:68943] [Feature #11081]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2015-05-06 20:30:43 +00:00
parent 8e08552ed0
commit 84b012e02a
5 changed files with 20 additions and 5 deletions

View file

@ -8,6 +8,7 @@
#
# $IPR: httpserver.rb,v 1.63 2002/10/01 17:16:32 gotoyuzo Exp $
require 'io/wait'
require 'webrick/server'
require 'webrick/httputils'
require 'webrick/httpstatus'
@ -72,7 +73,7 @@ module WEBrick
begin
timeout = @config[:RequestTimeout]
while timeout > 0
break if IO.select([sock], nil, nil, 0.5)
break if sock.to_io.wait_readable(0.5)
break if @status != :Running
timeout -= 0.5
end