6件ヒット
[1-6件を表示]
(0.107秒)
クラス
- Monitor (1)
-
Thread
:: ConditionVariable (3) -
Thread
:: Queue (2)
キーワード
- broadcast (1)
- close (1)
-
num
_ waiting (1) - signal (1)
-
wait
_ for _ cond (1)
検索結果
先頭5件
-
Thread
:: ConditionVariable # wait(mutex , timeout = nil) -> self (63439.0) -
mutex のロックを解放し、カレントスレッドを停止します。 Thread::ConditionVariable#signalまたは、 Thread::ConditionVariable#broadcastで送られたシグナルを 受け取ると、mutexのロックを取得し、実行状態となります。
mutex のロックを解放し、カレントスレッドを停止します。
Thread::ConditionVariable#signalまたは、
Thread::ConditionVariable#broadcastで送られたシグナルを
受け取ると、mutexのロックを取得し、実行状態となります。
@param mutex Mutex オブジェクトを指定します。
@param timeout スリープする秒数を指定します。この場合はシグナルを受け取
らなかった場合でも指定した秒数が経過するとスリープを終了
します。省略するとスリープし続け... -
Thread
:: Queue # num _ waiting -> Integer (27340.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
//} -
Monitor
# wait _ for _ cond(cond , timeout) -> true (18361.0) -
MonitorMixin::ConditionVariable 用の内部メソッドです。
MonitorMixin::ConditionVariable 用の内部メソッドです。
@param cond Thread::ConditionVariable を指定します。
@param timeout タイムアウトまでの秒数。指定しなかった場合はタイムアウトしません。
@return Ruby 1.9 の頃からのバグで常に true を返します。(16608)
//emlist[例][ruby]{
require 'monitor'
m = Monitor.new
cv = Thread::ConditionVariable.new
m.enter
m.wait_for_cond... -
Thread
:: ConditionVariable # broadcast -> self (9154.0) -
状態変数を待っているスレッドをすべて再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。
状態変数を待っているスレッドをすべて再開します。再開された
スレッドは Thread::ConditionVariable#wait
で指定した mutex のロックを試みます。
@return 常に self を返します。
//emlist[例][ruby]{
mutex = Mutex.new
cv = ConditionVariable.new
flg = true
3.times {
Thread.start {
mutex.synchronize {
puts "a1"
while (flg)
cv.wait(mutex)
... -
Thread
:: ConditionVariable # signal -> self (9154.0) -
状態変数を待っているスレッドを1つ再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。
状態変数を待っているスレッドを1つ再開します。再開された
スレッドは Thread::ConditionVariable#wait
で指定した mutex のロックを試みます。
@return 常に self を返します。
//emlist[例][ruby]{
mutex = Mutex.new
cv = ConditionVariable.new
flg = true
3.times {
Thread.start {
mutex.synchronize {
puts "a1"
while (flg)
cv.wait(mutex)
... -
Thread
:: Queue # close -> self (9130.0) -
キューを close します。close 済みのキューを再度 open することはできません。
キューを close します。close 済みのキューを再度 open することはできません。
close 後は以下のように動作します。
* Thread::Queue#closed? は true を返します
* Thread::Queue#close は無視されます
* Thread::Queue#enq/push/<< は ClosedQueueError を発生します
* Thread::Queue#empty? が false を返す場合は Thread::Queue#deq/pop/shift は通常通りオブジェクトを返します
また、ClosedQueueError...