るりまサーチ

最速Rubyリファレンスマニュアル検索!
9件ヒット [1-9件を表示] (0.065秒)
トップページ > クエリ:_builtin[x] > クエリ:puts[x] > クエリ:broadcast[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

検索結果

Thread::ConditionVariable#broadcast -> self (26119.0)

状態変数を待っているスレッドをすべて再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。

....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
//...