72件ヒット
[1-72件を表示]
(0.155秒)
クラス
- Mutex (2)
-
PStore
:: DummyMutex (12) -
Thread
:: ConditionVariable (24) -
Thread
:: Mutex (10)
モジュール
-
Mutex
_ m (24)
キーワード
- broadcast (12)
-
mu
_ synchronize (12) - signal (12)
検索結果
先頭5件
-
Mutex
# synchronize { . . . } -> object (27146.0) -
mutex をロックし、ブロックを実行します。実行後に必ず mutex のロックを解放します。
...
mutex をロックし、ブロックを実行します。実行後に必ず mutex のロックを解放します。
ブロックが最後に評価した値を返します。
@raise ThreadError self 既にカレントスレッドにロックされている場合に発
生しま......また、Signal.#trap に指定したハンドラ内で実行
した場合に発生します。
//emlist[例][ruby]{
m = Mutex.new
result = m.synchronize do
m.locked? # => true
# critical part
"result"
end
m.locked? # => false
result # => "result"
//}... -
Thread
:: Mutex # synchronize { . . . } -> object (21146.0) -
mutex をロックし、ブロックを実行します。実行後に必ず mutex のロックを解放します。
...
mutex をロックし、ブロックを実行します。実行後に必ず mutex のロックを解放します。
ブロックが最後に評価した値を返します。
@raise ThreadError self 既にカレントスレッドにロックされている場合に発
生しま......また、Signal.#trap に指定したハンドラ内で実行
した場合に発生します。
//emlist[例][ruby]{
m = Mutex.new
result = m.synchronize do
m.locked? # => true
# critical part
"result"
end
m.locked? # => false
result # => "result"
//}... -
Mutex
_ m # synchronize { . . . } -> object (21103.0) -
self のロックを取得し、ブロックを実行します。実行後に必ずロックを解放します。
self のロックを取得し、ブロックを実行します。実行後に必ずロックを解放します。
ブロックで最後に評価した値を返します。 -
PStore
:: DummyMutex # synchronize { . . . } -> object (21102.0) -
与えられたブロックを評価するだけで何もしません。
与えられたブロックを評価するだけで何もしません。 -
Mutex
_ m # mu _ synchronize { . . . } -> object (9103.0) -
self のロックを取得し、ブロックを実行します。実行後に必ずロックを解放します。
self のロックを取得し、ブロックを実行します。実行後に必ずロックを解放します。
ブロックで最後に評価した値を返します。 -
Thread
:: ConditionVariable # broadcast -> self (59.0) -
状態変数を待っているスレッドをすべて再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。
...ait
で指定した 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)
end......puts "a2"
}
}
}
Thread.start {
mutex.synchronize {
flg = false
cv.broadcast
}
}
sleep 1
# => a1
# => a1
# => a1
# => a2
# => a2
# => a2
//}... -
Thread
:: ConditionVariable # signal -> self (59.0) -
状態変数を待っているスレッドを1つ再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。
...ait
で指定した 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)
end......puts "a2"
}
}
}
Thread.start {
mutex.synchronize {
flg = false
cv.signal
}
}
sleep 1
# => a1
# => a1
# => a1
# => a2
//}...