ライブラリ
- ビルトイン (295)
-
cgi
/ util (12) - date (228)
- etc (12)
- monitor (310)
-
rubygems
/ command (24) -
rubygems
/ server (12) - socket (48)
- syslog (12)
- time (24)
-
webrick
/ accesslog (12) -
webrick
/ server (12)
クラス
- CGI (12)
- Date (156)
- DateTime (72)
-
Gem
:: Command (24) -
Gem
:: Server (12) - Monitor (114)
-
MonitorMixin
:: ConditionVariable (60) - Socket (24)
- Time (235)
モジュール
- Etc (12)
- MonitorMixin (100)
- Process (84)
-
Socket
:: Constants (24) -
Syslog
:: Facility (12) -
WEBrick
:: AccessLog (12)
キーワード
-
CLOCK
_ MONOTONIC (12) -
CLOCK
_ MONOTONIC _ COARSE (12) -
CLOCK
_ MONOTONIC _ FAST (12) -
CLOCK
_ MONOTONIC _ PRECISE (12) -
CLOCK
_ MONOTONIC _ RAW (12) -
CLOCK
_ MONOTONIC _ RAW _ APPROX (12) -
COMMON
_ LOG _ FORMAT (12) - ConditionVariable (12)
- Daemon (12)
-
IFF
_ MASTER _ ARPMON (24) -
IFF
_ MONITOR (24) -
LOG
_ DAEMON (12) - Monitor (12)
- MonitorMixin (12)
-
RFC822
_ MONTHS (12) -
SC
_ MONOTONIC _ CLOCK (12) -
_ strptime (24) -
add
_ common _ option (12) - broadcast (12)
- civil (24)
- daemon (12)
- enter (12)
- exit (12)
- gm (24)
- httpdate (24)
- local (24)
- mktime (24)
-
mon
_ check _ owner (6) -
mon
_ enter (18) -
mon
_ exit (18) -
mon
_ locked? (14) -
mon
_ owned? (14) -
mon
_ synchronize (18) -
mon
_ try _ enter (18) - monday? (24)
- monitor (12)
- month (24)
- new (79)
-
new
_ cond (18) -
next
_ month (12) - now (12)
- parse (24)
-
prev
_ month (12) - rfc2822 (24)
- rfc822 (24)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 4 feature (12) - signal (12)
- strftime (12)
- synchronize (18)
-
to
_ a (12) -
try
_ enter (12) -
try
_ mon _ enter (18) - utc (24)
-
valid
_ civil? (12) -
valid
_ date? (12) - wait (12)
-
wait
_ for _ cond (6) -
wait
_ until (12) -
wait
_ while (12) - wday (12)
検索結果
先頭5件
-
Monitor (6042.0)
-
スレッドの同期機構としてのモニター機能を提供するクラスです。 また同じスレッドから何度も lock できる Mutex としての機能も提供します。
...供します。
MonitorMixin を include し、いくつかの別名を定義したクラスです。
=== 例
//emlist[消費者、生産者問題の例][ruby]{
require 'monitor'
buf = []
mon = Monitor.new
empty_cond = mon.new_cond
# consumer
Thread.start do
loop do
mon.synchronize do......ile line = ARGF.gets
mon.synchronize do
buf.push(line)
empty_cond.signal
end
end
//}
2回ロックしてもデッドロックにならない例です。
//emlist[デッドロックにならない例][ruby]{
require 'monitor'
mon = Monitor.new
mon.synchronize {
mon.synchronize {
}
}... -
MonitorMixin
# synchronize { . . . } -> object (6007.0) -
モニターをロックし、ブロックを実行します。実行後に必ずモニターのロックを解放します。
...モニターをロックし、ブロックを実行します。実行後に必ずモニターのロックを解放します。
ブロックの評価値を返り値として返します。
@see MonitorMixin#mon_enter... -
Monitor
# try _ enter -> bool (6002.0) -
モニターのロックを取得しようと試みます。 ロックに成功した(ロックが開放状態だった、もしくは ロックを取得していたスレッドが自分自身であった)場合には 真を返します。
モニターのロックを取得しようと試みます。
ロックに成功した(ロックが開放状態だった、もしくは
ロックを取得していたスレッドが自分自身であった)場合には
真を返します。
ロックができなかった場合は偽を返し、実行を継続します。この場合には
スレッドはブロックしません。 -
Monitor
# synchronize { . . . } -> object (6001.0) -
モニターをロックし、ブロックを実行します。実行後に必ずモニターのロックを解放します。
...モニターをロックし、ブロックを実行します。実行後に必ずモニターのロックを解放します。
ブロックの評価値を返り値として返します。
@see Monitor#enter... -
MonitorMixin (6000.0)
-
スレッドの同期機構としてのモニター機能を提供するモジュールです。
...ス/オブジェクトに
モニタ機能を追加します。
=== 例
//emlist[消費者、生産者問題の例][ruby]{
require 'monitor'
buf = []
buf.extend(MonitorMixin) # 配列にモニタ機能を追加
empty_cond = buf.new_cond # 配列が空であるかないかを通知する条件変......=== 初期化
MonitorMixin は初期化される必要があります。
上の例のように Object#extend を使って利用する場合は
自動的に初期化されます。
//emlist[extend する例][ruby]{
require 'monitor'
buf = []
buf.extend(MonitorMixin)
//}
しかし、MonitorMixin......受け付けないので
super ではなく super() を呼ぶ必要があります。
//emlist[include する例][ruby]{
require 'monitor'
class MyObject
include MonitorMixin
def initialize(val)
super()
@value = val
end
def to_s
synchronize {
@value.to_s
}
end
end... -
WEBrick
:: Daemon (6000.0) -
サーバのタイプを表すクラスです。 WEBrick::GenericServer.new の設定の :ServerType の値として指定した場合 サーバはデーモンとして動作します。
サーバのタイプを表すクラスです。
WEBrick::GenericServer.new の設定の :ServerType の値として指定した場合
サーバはデーモンとして動作します。 -
Etc
:: SC _ MONOTONIC _ CLOCK -> Integer (3100.0) -
Etc.#sysconf の引数に指定します。
Etc.#sysconf の引数に指定します。
詳細は sysconf(3) を参照してください。 -
Monitor
# new _ cond -> MonitorMixin :: ConditionVariable (3100.0) -
モニターに関連付けられた、新しい MonitorMixin::ConditionVariable を生成して返します。
...モニターに関連付けられた、新しい MonitorMixin::ConditionVariable を生成して返します。... -
Monitor
. new -> Monitor (3100.0) -
新しい Monitor オブジェクトを生成します。
...新しい Monitor オブジェクトを生成します。... -
MonitorMixin
# new _ cond -> MonitorMixin :: ConditionVariable (3100.0) -
モニターに関連付けられた、新しい MonitorMixin::ConditionVariable を生成して返します。
...モニターに関連付けられた、新しい MonitorMixin::ConditionVariable を生成して返します。...