ライブラリ
- ビルトイン (166)
-
io
/ wait (12) - monitor (54)
- open3 (168)
-
shell
/ builtin-command (6) -
shell
/ system-command (6) - socket (36)
- sync (18)
- thread (10)
- thwait (78)
クラス
-
ARGF
. class (10) - IO (24)
- Monitor (6)
-
MonitorMixin
:: ConditionVariable (36) -
Shell
:: BuiltInCommand (6) -
Shell
:: SystemCommand (6) - Socket (24)
-
Thread
:: ConditionVariable (36) -
Thread
:: Queue (22) - ThreadsWait (60)
モジュール
- Open3 (168)
- Process (48)
- Signal (24)
-
Socket
:: Constants (12) -
Sync
_ m (18)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - ConditionVariable (12)
- ErrNoFinishedThread (6)
- ErrNoWaitingThread (6)
-
MSG
_ DONTWAIT (24) - MonitorMixin (12)
-
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - Rubyの起動 (7)
- ThreadsWait (6)
- WaitReadable (12)
-
all
_ waits (18) - broadcast (12)
- close (10)
-
connect
_ nonblock (12) - empty? (6)
- finished? (6)
- join (6)
-
join
_ nowait (6) - new (6)
-
next
_ wait (6) -
num
_ waiting (12) -
pipeline
_ r (24) -
pipeline
_ rw (24) -
pipeline
_ start (24) -
pipeline
_ w (24) - popen2 (24)
- popen2e (24)
- popen3 (24)
-
rb
_ thread _ polling (1) -
rb
_ thread _ schedule (12) -
rb
_ thread _ wait _ fd (12) -
rb
_ thread _ wait _ for (12) -
rb
_ thread _ wait _ other _ threads (12) -
read
_ nonblock (22) -
ruby 1
. 8 . 4 feature (12) - signal (12)
-
sync
_ upgrade _ waiting (6) -
sync
_ upgrade _ waiting= (6) -
sync
_ waiting (6) - threads (6)
- trap (24)
- wait2 (12)
- wait? (12)
-
wait
_ for _ cond (6) -
wait
_ readable (12) -
wait
_ until (12) -
wait
_ while (12) - waitpid (12)
- waitpid2 (12)
検索結果
先頭5件
-
MonitorMixin
:: ConditionVariable # wait(timeout = nil) -> bool (21113.0) -
モニタのロックを開放し、現在のスレッドを停止します。
...これを呼ぶスレッドはモニタのロックを保持している必要があります。
MonitorMixin::ConditionVariable#signal や
MonitorMixin::ConditionVariable#broadcast
で起こされるまでスレッドは停止し続けます。
timeout を与えた場合は最大 timeout 秒ま......での秒数。指定しなかった場合はタイムアウトしません。
@raise ThreadError ロックを持っていないスレッドがこのメソッドを呼びだした場合に発生します
@see MonitorMixin::ConditionVariable#wait_while, MonitorMixin::ConditionVariable#wait_until... -
Thread
:: ConditionVariable # wait(mutex , timeout = nil) -> self (21101.0) -
mutex のロックを解放し、カレントスレッドを停止します。 Thread::ConditionVariable#signalまたは、 Thread::ConditionVariable#broadcastで送られたシグナルを 受け取ると、mutexのロックを取得し、実行状態となります。
...ントスレッドを停止します。
Thread::ConditionVariable#signalまたは、
Thread::ConditionVariable#broadcastで送られたシグナルを
受け取ると、mutexのロックを取得し、実行状態となります。
@param mutex Thread::Mutex オブジェクトを指定します。......ます。この場合はシグナルを受け取
らなかった場合でも指定した秒数が経過するとスリープを終了
します。省略するとスリープし続けます。
@see Thread::ConditionVariable#signal, Thread::ConditionVariable#broadcast......mutex のロックを解放し、カレントスレッドを停止します。
Thread::ConditionVariable#signalまたは、
Thread::ConditionVariable#broadcastで送られたシグナルを
受け取ると、mutexのロックを取得し、実行状態となります。
@param mutex Mutex オブ... -
Process
. # wait(pid = -1 , flags = 0) -> Integer | nil (18236.0) -
pid で指定される特定の子プロセスの終了を待ち、そのプロセスが 終了した時に pid を返します。 wait2, waitpid2 は子プロセスの pid と終了ステータスを表す Process::Status オブジェクトの配列を返します。 ノンブロッキングモードで子プロセスがまだ終了していない時には nil を返します。
...pid で指定される特定の子プロセスの終了を待ち、そのプロセスが
終了した時に pid を返します。
wait2, waitpid2 は子プロセスの pid と終了ステータスを表す
Process::Status オブジェクトの配列を返します。
ノンブロッキングモー......セットされます。
@param pid 子プロセスのプロセス ID を整数で指定します。
0 以上なら指定されたプロセス ID の子プロセスを待ちます。
0 なら呼び出し元のプロセスとプロセスグループ ID が同じ任意の子プロセス......ます。
-1 未満なら pid の絶対値とプロセスグループ ID が同じ任意の子プロセスを待ちます。
@param flags Process モジュールの定数 Process::WNOHANG(ノンブロッキングモード)と
Process::WUNTRACED の論理和を指定します。... -
ThreadsWait
:: ErrNoWaitingThread (15006.0) -
終了を待つスレッドが存在しない時、発生します。
...終了を待つスレッドが存在しない時、発生します。
@see ThreadsWait#next_wait... -
Monitor
# wait _ for _ cond(cond , timeout) -> bool (12207.0) -
MonitorMixin::ConditionVariable 用の内部メソッドです。
...MonitorMixin::ConditionVariable 用の内部メソッドです。
@param cond Thread::ConditionVariable を指定します。
@param timeout タイムアウトまでの秒数。指定しなかった場合はタイムアウトしません。
@return タイムアウトしたときは false を返し......ます。それ以外は true を返します。
//emlist[例][ruby]{
require 'monitor'
m = Monitor.new
cv = Thread::ConditionVariable.new
m.enter
m.wait_for_cond(cv, 1)
//}... -
Monitor
# wait _ for _ cond(cond , timeout) -> true (12207.0) -
MonitorMixin::ConditionVariable 用の内部メソッドです。
...MonitorMixin::ConditionVariable 用の内部メソッドです。
@param cond Thread::ConditionVariable を指定します。
@param timeout タイムアウトまでの秒数。指定しなかった場合はタイムアウトしません。
@return Ruby 1.9 の頃からのバグで常に true を......返します。(16608)
//emlist[例][ruby]{
require 'monitor'
m = Monitor.new
cv = Thread::ConditionVariable.new
m.enter
m.wait_for_cond(cv, 1)
//}... -
ThreadsWait
# next _ wait(nonblock = nil) -> Thread (12207.0) -
指定したスレッドのどれかが終了するまで待ちます。
...ThreadsWait::ErrNoFinishedThread が発生します。
@raise ErrNoWaitingThread 終了をまつスレッドが存在しない時、発生します。
@raise ErrNoFinishedThread nonblock がtrue でかつ、キューが空の時、発生します。
#使用例
require 'thwait'
threads = [......]
2.times {|i|
threads << Thread.new { sleep i }
}
thall = ThreadsWait.new
thall.join_nowait(*threads)
until thall.empty?
th = thall.next_wait
p th
end
@see Queue#pop... -
Socket
:: Constants :: MSG _ DONTWAIT -> Integer (12200.0) -
This message should be non-blocking。
...This message should be non-blocking。
BasicSocket#send, BasicSocket#sendmsg,
BasicSocket#recv, BasicSocket#recvmsg の
flags 引数に用います。
@see send(2linux), recv(2linux),
recv(2freebsd)... -
Socket
:: MSG _ DONTWAIT -> Integer (12200.0) -
This message should be non-blocking。
...This message should be non-blocking。
BasicSocket#send, BasicSocket#sendmsg,
BasicSocket#recv, BasicSocket#recvmsg の
flags 引数に用います。
@see send(2linux), recv(2linux),
recv(2freebsd)... -
Sync
_ m # sync _ upgrade _ waiting -> [Thread] (12200.0) -
@todo
...@todo... -
Sync
_ m # sync _ upgrade _ waiting=(arr) (12200.0) -
@todo
...@todo... -
ThreadsWait
# join _ nowait(*threads) -> () (12200.0) -
終了を待つスレッドの対象として、threads で指定されたスレッドを指定します。 しかし、実際には終了をまちません。
...threads で指定されたスレッドを指定します。
しかし、実際には終了をまちません。
@param threads 複数スレッドの終了を待つスレッドに指定されたthreadsを加えます。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { s......leep 1; p Thread.current }
}
thall = ThreadsWait.new
p thall.threads #=> []
thall.join_nowait(*threads)
p thall.threads #=> [#<Thread:0x21638 sleep>, #<Thread:0x215ac sleep>, #<Thread:0x21520 sleep>, #<Thread:0x21494 sleep>, #<Thread:0x21408 sleep>]
# 実際には終了を待ってい... -
ThreadsWait
. all _ waits(*threads) -> () (12200.0) -
指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。
...ads 終了するまでまつスレッドを一つもしくは複数指定します。
require 'thwait'
threads = []
5.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
ThreadsWait.all_waits(*threads) {|th| printf("end %s\n", th.inspect) }
# 出力例
#=> #<Thread:......0x21584 run>
#=> #<Thread:0x21610 run>
#=> #<Thread:0x2169c run>
#=> #<Thread:0x21728 run>
#=> #<Thread:0x214f8 run>
#=> end #<Thread:0x21584 dead>
#=> end #<Thread:0x21610 dead>
#=> end #<Thread:0x2169c dead>
#=> end #<Thread:0x21728 dead>
#=> end #<Thread:0x214f8 dead>...