5件ヒット
[1-5件を表示]
(0.021秒)
別のキーワード
検索結果
先頭5件
-
ThreadsWait
# join(*threads) -> () (304.0) -
終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。
...eadsを加えます。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new
p thall.threads #=> []
thall.join(*threads)
p thall.threads
#=> [#<Thread:0x216ec dead>, #<Thread:0x21660 dead>, #<Thread:0x215d4 d... -
ThreadsWait
# join _ nowait(*threads) -> () (304.0) -
終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。 しかし、実際には終了をまちません。
...eadsを加えます。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new
p thall.threads #=> []
thall.join_nowait(*threads)
p thall.threads #=> [#<Thread:0x21638 sleep>, #<Thread:0x215ac sleep>, #<Thread:0x... -
ThreadsWait
. all _ waits(*threads) -> () (304.0) -
指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。
...くは複数指定します。
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) }
# 出力例
#=> #<Thread:0x21584 run>
#=> #<Thread:0x21610 run>
#=> #<Thread... -
ThreadsWait
. all _ waits(*threads) {|thread| . . . } -> () (304.0) -
指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。
...くは複数指定します。
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) }
# 出力例
#=> #<Thread:0x21584 run>
#=> #<Thread:0x21610 run>
#=> #<Thread... -
ThreadsWait
. new(*threads) -> ThreadsWait (304.0) -
指定されたスレッドの終了をまつための、スレッド同期オブジェクトをつくります。
...ます。
使用例
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", th.inspect)
}
# 出力例
#=> #<Thread:0x214bc run>
#=> #<Thread:0x21548...