るりまサーチ

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

別のキーワード

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

検索結果

Thread::SizedQueue#max=(n) (29108.0)

キューの最大サイズを設定します。

...キューの最大サイズを設定します。

@param n キューの最大サイズを指定します。

//emlist[例][ruby]{
q = SizedQueue.new(4)
q.max # => 4
q.max = 5
q.max # => 5
//}...

Thread::ConditionVariable (8020.0)

スレッドの同期機構の一つである状態変数を実現するクラスです。

...

require 'thread'

class TinyQueue
def initialize(max=2)
@max = max
@full = ConditionVariable.new
@empty = ConditionVariable.new
@mutex = Mutex.new
@q = []
end

def count
@q.size
end

def enq(v)
@mutex.synchronize{
@full.w...