33件ヒット
[1-33件を表示]
(0.095秒)
ライブラリ
- monitor (11)
- singleton (11)
-
win32
/ registry (11)
キーワード
- Constants (11)
- MonitorMixin (11)
- Singleton (11)
検索結果
-
MonitorMixin (6013.0)
-
スレッドの同期機構としてのモニター機能を提供するモジュールです。
...。
クラスに Module#include したり、オブジェクトに
Object#extend したりすることでそのクラス/オブジェクトに
モニタ機能を追加します。
=== 例
//emlist[消費者、生産者問題の例][ruby]{
require 'monitor'
buf = []
buf.extend(MonitorMixin) # 配......列にモニタ機能を追加
empty_cond = buf.new_cond # 配列が空であるかないかを通知する条件変数
# consumer
Thread.start do
loop do
buf.synchronize do # ロックする
empty_cond.wait_while { buf.empty? } # 配列が空である間はロックを開放して待......hile line = ARGF.gets
buf.synchronize do # ロックする
buf.push(line) # 配列を変更(追加)
empty_cond.signal # 配列に要素が追加されたことを条件変数を通して通知
end # ここでロックを開放
end
//}
=== 初期化
MonitorMixin は初期化される必... -
Singleton (6013.0)
-
Singleton パターンを提供するモジュールです。
...eton パターンを提供するモジュールです。
Mix-in により singleton パターンを提供します。
Singleton モジュールを include することにより、クラスは
高々ひとつのインスタンスしか持たないことが保証されます。
Singleton を Mix-in......'singleton'
class SomeSingletonClass
include Singleton
#....
end
a = SomeSingletonClass.instance
b = SomeSingletonClass.instance # a and b are same object
p [a,b] # => [#<SomeSingletonClass:0x0000562e6e18ddd0>, #<SomeSingletonClass:0x0000562e6e18ddd0>]
a = SomeSingletonClass.ne......w # => NoMethodError (private method `new' called for SomeSingletonClass:Class)... -
Win32
:: Registry :: Constants (6007.0) -
詳細は以下の MSDN Library を参照してください。
...詳細は以下の MSDN Library を参照してください。
* Registry: http://msdn.microsoft.com/library/en-us/sysinfo/base/registry.asp...