5件ヒット
[1-5件を表示]
(0.170秒)
クラス
-
Thread
:: Queue (1) - ThreadsWait (4)
キーワード
- empty? (1)
-
join
_ nowait (1) -
next
_ wait (1) -
num
_ waiting (1)
検索結果
先頭5件
-
ThreadsWait
# join(*threads) -> () (81943.0) -
終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。
終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。
@param threads 複数スレッドの終了を待つスレッドに指定されたthreadsを加えます。
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
... -
ThreadsWait
# join _ nowait(*threads) -> () (64225.0) -
終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。 しかし、実際には終了をまちません。
終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。
しかし、実際には終了をまちません。
@param threads 複数スレッドの終了を待つスレッドに指定されたthreadsを加えます。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new
p thall.threads #=> []
thall.join_nowait(*thr... -
ThreadsWait
# next _ wait(nonblock = nil) -> Thread (45943.0) -
指定したスレッドのどれかが終了するまで待ちます。
指定したスレッドのどれかが終了するまで待ちます。
@param nonblock true を与えると、キューが空の時、例外 ThreadsWait::ErrNoFinishedThread が発生します。
@raise ErrNoWaitingThread 終了をまつスレッドが存在しない時、発生します。
@raise ErrNoFinishedThread nonblock がtrue でかつ、キューが空の時、発生します。
#使用例
require 'thwait'
threads = []
2.times {|i|
threads << Thread.n... -
Thread
:: Queue # num _ waiting -> Integer (36622.0) -
キューを待っているスレッドの数を返します。
キューを待っているスレッドの数を返します。
//emlist[例][ruby]{
require 'thread'
q = SizedQueue.new(1)
q.push(1)
t = Thread.new { q.push(2) }
sleep 0.05 until t.stop?
q.num_waiting # => 1
q.pop
t.join
//} -
ThreadsWait
# empty? -> bool (27022.0) -
同期されるスレッドが存在するならば true をかえします。
同期されるスレッドが存在するならば true をかえします。
使用例
require 'thwait'
threads = []
3.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new
p thall.threads.empty? #=> true
thall.join(*threads)
p thall.threads.empty? #=> false