Misc #10339 ยป timeout-error-name-normalization.patch
bootstraptest/test_io.rb | ||
---|---|---|
t1.join
|
||
t2.join
|
||
end
|
||
rescue LoadError, TimeoutError, NotImplementedError
|
||
rescue LoadError, Timeout::Error, NotImplementedError
|
||
end
|
||
}, '[ruby-dev:32566]'
|
||
doc/ChangeLog-1.9.3 | ||
---|---|---|
Sat Jun 13 06:50:31 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||
* lib/net/protocol.rb (Net::BufferedIO#rbuf_fill): TimeoutError is
|
||
* lib/net/protocol.rb (Net::BufferedIO#rbuf_fill): Timeout::Error is
|
||
obsolete, use Timeout::Error instead. [ruby-core:23821]
|
||
Sat Jun 13 06:45:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
lib/net/ftp.rb | ||
---|---|---|
# Number of seconds to wait for one block to be read (via one read(2)
|
||
# call). Any number may be used, including Floats for fractional
|
||
# seconds. If the FTP object cannot read data in this many seconds,
|
||
# it raises a TimeoutError exception. The default value is 60 seconds.
|
||
# it raises a Timeout::Error exception. The default value is 60 seconds.
|
||
attr_reader :read_timeout
|
||
# Setter for the read_timeout attribute.
|
lib/resolv.rb | ||
---|---|---|
##
|
||
# Indicates a timeout resolving a name or address.
|
||
class ResolvTimeout < TimeoutError; end
|
||
class ResolvTimeout < Timeout::Error; end
|
||
##
|
||
# Resolv::Hosts is a hostname resolver that uses the system hosts file.
|
lib/webrick/httprequest.rb | ||
---|---|---|
}
|
||
rescue Errno::ECONNRESET
|
||
return nil
|
||
rescue TimeoutError
|
||
rescue Timeout::Error
|
||
raise HTTPStatus::RequestTimeout
|
||
end
|
||
end
|
sample/timeout.rb | ||
---|---|---|
p timeout(5) {
|
||
45
|
||
}
|
||
p timeout(5, TimeoutError) {
|
||
p timeout(5, Timeout::Error) {
|
||
45
|
||
}
|
||
p timeout(nil) {
|
test/drb/drbtest.rb | ||
---|---|---|
def test_06_timeout
|
||
ten = Onecky.new(10)
|
||
assert_raise(TimeoutError) do
|
||
assert_raise(Timeout::Error) do
|
||
@there.do_timeout(ten)
|
||
end
|
||
assert_raise(TimeoutError) do
|
||
assert_raise(Timeout::Error) do
|
||
@there.do_timeout(ten)
|
||
end
|
||
end
|
test/ruby/test_readpartial.rb | ||
---|---|---|
w << 'abc'
|
||
assert_equal('ab', r.readpartial(2))
|
||
assert_equal('c', r.readpartial(2))
|
||
assert_raise(TimeoutError) {
|
||
assert_raise(Timeout::Error) {
|
||
timeout(0.1) { r.readpartial(2) }
|
||
}
|
||
}
|
||
... | ... | |
assert_equal("de", r.readpartial(2))
|
||
assert_equal("f\n", r.readpartial(4096))
|
||
assert_equal("ghi\n", r.readpartial(4096))
|
||
assert_raise(TimeoutError) {
|
||
assert_raise(Timeout::Error) {
|
||
timeout(0.1) { r.readpartial(2) }
|
||
}
|
||
}
|
test/thread/test_queue.rb | ||
---|---|---|
th1.raise
|
||
sleep 0.1
|
||
q << :s
|
||
assert_nothing_raised(TimeoutError) do
|
||
assert_nothing_raised(Timeout::Error) do
|
||
timeout(1) { th2.join }
|
||
end
|
||
ensure
|
thread.c | ||
---|---|---|
* resource allocation code. Then, the ensure block is where we can safely
|
||
* deallocate your resources.
|
||
*
|
||
* ==== Guarding from TimeoutError
|
||
* ==== Guarding from Timeout::Error
|
||
*
|
||
* In the next example, we will guard from the TimeoutError exception. This
|
||
* will help prevent from leaking resources when TimeoutError exceptions occur
|
||
* In the next example, we will guard from the Timeout::Error exception. This
|
||
* will help prevent from leaking resources when Timeout::Error exceptions occur
|
||
* during normal ensure clause. For this example we use the help of the
|
||
* standard library Timeout, from lib/timeout.rb
|
||
*
|
||
* require 'timeout'
|
||
* Thread.handle_interrupt(TimeoutError => :never) {
|
||
* Thread.handle_interrupt(Timeout::Error => :never) {
|
||
* timeout(10){
|
||
* # TimeoutError doesn't occur here
|
||
* Thread.handle_interrupt(TimeoutError => :on_blocking) {
|
||
* # possible to be killed by TimeoutError
|
||
* # Timeout::Error doesn't occur here
|
||
* Thread.handle_interrupt(Timeout::Error => :on_blocking) {
|
||
* # possible to be killed by Timeout::Error
|
||
* # while blocking operation
|
||
* }
|
||
* # TimeoutError doesn't occur here
|
||
* # Timeout::Error doesn't occur here
|
||
* }
|
||
* }
|
||
*
|
||
* In the first part of the +timeout+ block, we can rely on TimeoutError being
|
||
* ignored. Then in the <code>TimeoutError => :on_blocking</code> block, any
|
||
* In the first part of the +timeout+ block, we can rely on Timeout::Error being
|
||
* ignored. Then in the <code>Timeout::Error => :on_blocking</code> block, any
|
||
* operation that will block the calling thread is susceptible to a
|
||
* TimeoutError exception being raised.
|
||
* Timeout::Error exception being raised.
|
||
*
|
||
* ==== Stack control settings
|
||
*
|