* ext/io/wait/wait.c (io_wait_readable): simply returns that IO is
readable without blocking, but no longer returns EOF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/io/wait/wait.c (io_ready_p, io_wait_readable): try polling
first and check FIONREAD optionally to see if EOF.
[ruby-core:36805] [Feature #4849]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/io/wait/wait.c (io_wait_writable): fix rdoc. no EOF to
write. retursn nil when timeout, not self.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_file_exhaustive.rb: use assert_predicate and
assert_not_predicate for better failure messages.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This is for consistency with accept_nonblock arguments and gives a
minor speedup from avoiding exceptions.
[ruby-core:68838] [Feature #11024]
* ext/openssl/ossl_ssl.c (ossl_ssl_connect_nonblock):
support `exception: false'
* (get_no_exception): move function location
* ext/socket/socket.c (sock_connect_nonblock):
support `exception: false'
* test/openssl/test_pair.rb (test_connect_accept_nonblock_no_exception):
test `exception: false' on connect,
rename from `test_accept_nonblock_no_exception'
* test/socket/test_nonblock.rb (test_connect_nonblock_no_exception):
new test
Benchmark results:
default 0.050000 0.100000 0.150000 ( 0.151307)
exception: false 0.030000 0.080000 0.110000 ( 0.108840)
----------------------------8<-----------------------
require 'socket'
require 'benchmark'
require 'io/wait'
require 'tmpdir'
host = '127.0.0.1'
serv = TCPServer.new(host, 0) # UNIX sockets may not hit EINPROGRESS
nr = 5000 # few iterations to avoid running out of ports
addr = serv.getsockname
pid = fork do
begin
serv.accept.close
rescue => e
warn "#$$: #{e.message} (#{e.class})"
end while true
end
at_exit { Process.kill(:TERM, pid) }
serv.close
Benchmark.bmbm do |x|
x.report("default") do
nr.times do
s = Socket.new(:INET, :STREAM)
s.setsockopt(:SOL_SOCKET, :SO_REUSEADDR, 1)
begin
s.connect_nonblock(addr)
rescue IO::WaitWritable
s.wait_writable
end
s.close
end
end
x.report("exception: false") do
nr.times do
s = Socket.new(:INET, :STREAM)
s.setsockopt(:SOL_SOCKET, :SO_REUSEADDR, 1)
case s.connect_nonblock(addr, exception: false)
when :wait_writable
s.wait_writable
end
s.close
end
end
end
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_file_exhaustive.rb (NTFS): flag for test of NTFS.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_file_exhaustive.rb (POSIX): flag for test of
POSIX-like filesystems.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_file_exhaustive.rb (test_owned_p): skipt when
running as super user.
* test/ruby/test_file_exhaustive.rb (test_stat_owned_p): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/io/wait/wait.c (get_timeout): extract function to get
timeout value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/mkmf.rb (xsystem): assume all warnings go to stderr but not
stdout. cl.exe always prints input file names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This doesn't change actual behavior because hardlinkfile invokes regular_file.
This change make it more explicit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Exceptions are noisy in debug output and waste allocations.
Use "exception: false" introduced in 2.1 to return symbols for
common errors instead.
Follow-up commits will be prepared to reduce EOFError exceptions
to further quiet debug output and IO.select may be replaced by
io/wait methods if available to reduce allocations.
[ruby-core:68787] [Feature #11044]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* dir.c (need_normalization): use getattrlist() if fgetattrlist()
is unavailable, on OSX 10.5. [ruby-core:68829] [Bug #11054]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/mkmf.rb (try_cppflags): set werror flag as same as cflags
and ldflags.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/mkmf.rb (try_compile): pass the given werror flag to try_do
to check if stderr is empty.
* lib/mkmf.rb (try_cflags, try_ldflags): default werror to true.
* win32/Makefile.sub (WERRORFLAG): remove useless option. VC does
not make warnings of unknown command option an error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e