るりまサーチ

最速Rubyリファレンスマニュアル検索!
41件ヒット [1-41件を表示] (0.025秒)
トップページ > ライブラリ:time[x] > クエリ:time[x] > クエリ:TimeoutError[x]

別のキーワード

  1. time iso8601
  2. time httpdate
  3. time rfc2822
  4. time strptime
  5. time parse

種類

モジュール

キーワード

検索結果

TimeoutError (44001.0)

Alias of Timeout::Error

...Alias of Timeout::Error...

Timeout.#timeout(sec, exception_class = nil) {|i| ... } -> object (9125.0)

ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。

...sec 秒の期限付きで実行します。
ブロックの実行時間が制限を過ぎたときは例外
Time
out::Error が発生します。

exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がは...
...アウト
require 'timeout'

def calc_pi(min)
loop do
x = rand
y = rand
x**2 + y**2 < 1.0 ? min[0] += 1 : min[1] += 1
end
end

t = 5
min = [ 0, 0]
begin
Time
out.timeout(t){
calc_pi(min)
}
rescue Timeout::Error
puts "timeout"
end

printf...
...るタイムアウト
#!/usr/bin/env ruby

require 'timeout'

class MYError < Exception;end
begin
Time
out.timeout(5, MYError) {
sleep(30)
}
rescue MYError => err
puts "MYError"
puts err
end

=== 注意

time
out による割り込みは Thread によって実現さ...

Timeout.#timeout(sec, exception_class, message) {|i| ... } -> object (9125.0)

ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。

...sec 秒の期限付きで実行します。
ブロックの実行時間が制限を過ぎたときは例外
Time
out::Error が発生します。

exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がは...
...アウト
require 'timeout'

def calc_pi(min)
loop do
x = rand
y = rand
x**2 + y**2 < 1.0 ? min[0] += 1 : min[1] += 1
end
end

t = 5
min = [ 0, 0]
begin
Time
out.timeout(t){
calc_pi(min)
}
rescue Timeout::Error
puts "timeout"
end

printf...
...るタイムアウト
#!/usr/bin/env ruby

require 'timeout'

class MYError < Exception;end
begin
Time
out.timeout(5, MYError) {
sleep(30)
}
rescue MYError => err
puts "MYError"
puts err
end

=== 注意

time
out による割り込みは Thread によって実現さ...

Timeout::Error (3013.0)

timeout で定義される例外クラスです。 関数 timeout がタイムアウトすると発生します。

...timeout で定義される例外クラスです。
関数 timeout がタイムアウトすると発生します。

time
out を使うライブラリを作成する場合は、ユーザが指定した
time
out を捕捉しないようにライブラリ内で TimeoutError のサブクラスを
定義...
...quire 'timeout.rb'
class Foo
FooTimeoutError = Class.new(TimeoutError)
def longlongtime_method
Time
out.timeout(100, FooTimeoutError) {
...
}
end
end

==> main.rb <==
require 'foo'
time
out(5)...
...{
Foo.new.longlongtime_method
}...