るりまサーチ

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

別のキーワード

  1. _builtin to_c
  2. etc sc_2_c_bind
  3. etc sc_2_c_dev
  4. tracer display_c_call
  5. tracer display_c_call=

ライブラリ

モジュール

キーワード

検索結果

<< < 1 2 >>

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

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

...read::ConditionVariable#wait
で指定した mutex のロックを試みます。

@return 常に self を返します。

//emlist[例][ruby]{
mutex = Mutex.new
c
v = ConditionVariable.new
flg = true

3.times {
Thread.start {
mutex.synchronize {
puts "a1"
while (flg)
c
v.wai...
...t(mutex)
end
puts "a2"
}
}
}

Thread.start {
mutex.synchronize {
flg = false
c
v.broadcast
}
}

sleep 1

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

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

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

...read::ConditionVariable#wait
で指定した mutex のロックを試みます。

@return 常に self を返します。

//emlist[例][ruby]{
mutex = Mutex.new
c
v = ConditionVariable.new
flg = true

3.times {
Thread.start {
mutex.synchronize {
puts "a1"
while (flg)
c
v.wai...
...t(mutex)
end
puts "a2"
}
}
}

Thread.start {
mutex.synchronize {
flg = false
c
v.signal
}
}

sleep 1

# => a1
# => a1
# => a1
# => a2
//}...
<< < 1 2 >>