55件ヒット
[1-55件を表示]
(0.015秒)
クラス
- Coverage (7)
- IO (12)
- Thread (18)
- ThreadsWait (18)
キーワード
-
all
_ waits (12) -
line
_ stub (7) - new (6)
-
report
_ on _ exception (9) -
report
_ on _ exception= (9) - select (12)
検索結果
先頭5件
-
Thread
. report _ on _ exception -> bool (13.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...。
Thread.new { 1.times { raise } }
は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
これによって... -
Thread
. report _ on _ exception=(newstate) (13.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...。
Thread.new { 1.times { raise } }
は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
これによって... -
Coverage
. line _ stub(file) -> Array (7.0) -
行カバレッジの配列のスタブを返します。
...要素は 0, 空行やコメントなどにより測定対象外となる行の要素は nil となります。
//emlist[foo.rb][ruby]{
s = 0
10.times do |x|
s += x
end
if s == 45
p :ok
else
p :ng
end
//}
このファイルに対して line_stub を実行すると、次のようになりま... -
IO
. select(reads , writes = [] , excepts = [] , timeout = nil) -> [[IO]] | nil (7.0) -
select(2) を実行します。
...ていた時に発生します。
@raise Errno::EXXX select(2) に失敗した場合に発生します。
rp, wp = IO.pipe
mesg = "ping "
100.times{
rs, ws, = IO.select([rp], [wp])
if r = rs[0]
ret = r.read(5)
print ret
case ret
when /ping/
mesg = "pong\n"... -
ThreadsWait
. all _ waits(*threads) -> () (7.0) -
指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。
...ます。
@param threads 終了するまでまつスレッドを一つもしくは複数指定します。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
ThreadsWait.all_waits(*threads) {|th| printf("end %s\n", th.inspect) }
# 出... -
ThreadsWait
. all _ waits(*threads) {|thread| . . . } -> () (7.0) -
指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。
...ます。
@param threads 終了するまでまつスレッドを一つもしくは複数指定します。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
ThreadsWait.all_waits(*threads) {|th| printf("end %s\n", th.inspect) }
# 出... -
ThreadsWait
. new(*threads) -> ThreadsWait (7.0) -
指定されたスレッドの終了をまつための、スレッド同期オブジェクトをつくります。
...す。
@param threads 終了を待つスレッドを一つもしくは複数指定します。
使用例
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new(*threads)
thall.all_waits{|th|
printf("end %s\n"...