るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.020秒)

別のキーワード

  1. drb thread
  2. thread exit
  3. thread join
  4. thread kill
  5. thread pending_interrupt?

ライブラリ

検索結果

Thread::ConditionVariable#signal -> self (29148.0)

状態変数を待っているスレッドを1つ再開します。再開された スレッドは 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 {
pu...
...ts "a1"
while (flg)
cv.wait(mutex)
end
puts "a2"
}
}
}

Thread
.start {
mutex.synchronize {
flg = false
cv.signal
}
}

sleep 1

# => a1
# => a1
# => a1
# => a2
//}...