12件ヒット
[1-12件を表示]
(0.015秒)
別のキーワード
検索結果
-
Thread
. handle _ interrupt(hash) { . . . } -> object (37.0) -
スレッドの割り込みのタイミングを引数で指定した内容に変更してブロックを 実行します。
...事ができます。
==== TimeoutError 対策
例:TimeoutError 発生のタイミングを制御する例
require 'timeout'
Thread.handle_interrupt(TimeoutError => :never) {
timeout(10){
# TimeoutError => :never の指定により、ここでは TimeoutError が発生しない。......ead.handle_interrupt(TimeoutError => :on_blocking) {
# :on_blocking な処理は TimeoutError が発生し得る。
}
# TimeoutError => :never の指定により、ここでは TimeoutError が発生しない。
}
}
この例を ensure 節での TimeoutError 発生に応......きます。Timeout.#timeout はスレッドを使って実装さ
れているため、Thread.handle_interrupt による制御が有効です。
==== Stack control settings
It's possible to stack multiple levels of ::handle_interrupt blocks in order
to control more than one ExceptionClass and Timi...