20件ヒット
[1-20件を表示]
(0.018秒)
キーワード
- ConditionVariable (9)
- ELIBMAX (11)
検索結果
-
Errno
:: ELIBMAX (6003.0) -
システムコールのエラーコードを表す例外クラスです。詳細は Errno::EXXX を参照してください。
システムコールのエラーコードを表す例外クラスです。詳細は Errno::EXXX を参照してください。 -
Thread
:: ConditionVariable (33.0) -
スレッドの同期機構の一つである状態変数を実現するクラスです。
...あるいは満タンになった場合に Condition Variable を使って wait しています。
require 'thread'
class TinyQueue
def initialize(max=2)
@max = max
@full = ConditionVariable.new
@empty = ConditionVariable.new
@mutex = Mutex.new
@q = []
en......e{
@full.wait(@mutex) if count == @max
@q.push v
@empty.signal if count == 1
}
end
def deq
@mutex.synchronize{
@empty.wait(@mutex) if count == 0
v = @q.shift
@full.signal if count == (@max - 1)
v
}
end
alias...