3件ヒット
[1-3件を表示]
(0.037秒)
キーワード
- ConditionVariable (1)
- GzipReader (1)
- SizedQueue (1)
検索結果
-
Zlib
:: GzipReader (18076.0) -
gzip 形式の圧縮ファイルを読み込むラッパークラスです。 IO クラスのインスタンス (又は IO クラスのインスタンスと同じメソッドを 持つオブジェクト) と関連付けて使用します。
gzip 形式の圧縮ファイルを読み込むラッパークラスです。
IO クラスのインスタンス (又は IO クラスのインスタンスと同じメソッドを
持つオブジェクト) と関連付けて使用します。
require 'zlib'
=begin
# hoge.gz がない場合は下記で作成できる。
Zlib::GzipWriter.open('hoge.gz') { |gz|
gz.puts 'hoge'
}
=end
Zlib::GzipReader.open('hoge.gz') {|gz|
print gz.read
}
f = File.op... -
Thread
:: ConditionVariable (9040.0) -
スレッドの同期機構の一つである状態変数を実現するクラスです。
...が空になった場合、
あるいは満タンになった場合に Condition Variable を使って wait しています。
require 'thread'
class TinyQueue
def initialize(max=2)
@max = max
@full = ConditionVariable.new
@empty = ConditionVariable.new
@mutex = Mut... -
Thread
:: SizedQueue (9022.0) -
サイズの最大値を指定できる Thread::Queue です。
サイズの最大値を指定できる Thread::Queue です。
=== 例
283 より。q をサイズ 1 の SizedQueue オブジェクトに
することによって、入力される行と出力される行が同じ順序になります。
q = [] にすると入力と違った順序で行が出力されます。
require 'thread'
q = SizedQueue.new(1)
th = Thread.start {
while line = q.pop
print line
end
}
while l = gets
q.push(l)
end
...