別のキーワード
種類
- インスタンスメソッド (203)
- 文書 (44)
- ライブラリ (11)
- モジュール (11)
クラス
-
File
:: Stat (11) - Pathname (11)
- SignalException (22)
- Thread (115)
-
Thread
:: ConditionVariable (22) - ThreadGroup (22)
キーワード
- <=> (11)
-
NEWS for Ruby 2
. 0 . 0 (11) - Observable (11)
- add (11)
-
backtrace
_ locations (22) - broadcast (11)
- ctime (11)
-
drb
/ gw (11) - enclose (11)
- exit (11)
- join (22)
- kill (11)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 3 feature (11) - run (11)
-
safe
_ level (5) - signal (11)
- signm (11)
- signo (11)
- terminate (11)
- value (11)
- wakeup (11)
- 制御構造 (11)
検索結果
先頭5件
-
Thread
# join -> self (152.0) -
スレッド self の実行が終了するまで、カレントスレッドを停止し ます。self が例外により終了していれば、その例外がカレントス レッドに対して発生します。
...スレッド self の実行が終了するまで、カレントスレッドを停止し
ます。self が例外により終了していれば、その例外がカレントス
レッドに対して発生します。
limit を指定して、limit 秒過ぎても自身が終了しない場合、nil......。
以下は、生成したすべてのスレッドの終了を待つ例です。
threads = []
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.each {|t| t.join}... -
Thread
# join(limit) -> self | nil (152.0) -
スレッド self の実行が終了するまで、カレントスレッドを停止し ます。self が例外により終了していれば、その例外がカレントス レッドに対して発生します。
...スレッド self の実行が終了するまで、カレントスレッドを停止し
ます。self が例外により終了していれば、その例外がカレントス
レッドに対して発生します。
limit を指定して、limit 秒過ぎても自身が終了しない場合、nil......。
以下は、生成したすべてのスレッドの終了を待つ例です。
threads = []
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.each {|t| t.join}... -
Thread
# exit -> self (115.0) -
スレッドの実行を終了させます。終了時に ensure 節が実行されます。
...it(0)
により終了します。
Kernel.#exit と違い例外 SystemExit を発生しません。
th1 = Thread.new do
begin
sleep 10
ensure
p "this will be displayed"
end
end
sleep 0.1
th1.kill
#=> "this will be displayed"
@see Kernel.#exit, Kernel.#exit!... -
Thread
# kill -> self (115.0) -
スレッドの実行を終了させます。終了時に ensure 節が実行されます。
...it(0)
により終了します。
Kernel.#exit と違い例外 SystemExit を発生しません。
th1 = Thread.new do
begin
sleep 10
ensure
p "this will be displayed"
end
end
sleep 0.1
th1.kill
#=> "this will be displayed"
@see Kernel.#exit, Kernel.#exit!... -
Thread
# terminate -> self (115.0) -
スレッドの実行を終了させます。終了時に ensure 節が実行されます。
...it(0)
により終了します。
Kernel.#exit と違い例外 SystemExit を発生しません。
th1 = Thread.new do
begin
sleep 10
ensure
p "this will be displayed"
end
end
sleep 0.1
th1.kill
#=> "this will be displayed"
@see Kernel.#exit, Kernel.#exit!... -
ruby 1
. 6 feature (114.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...するとエラーになっていました。
((<ruby-dev:17155>))
open("|-","r+") {|f|
if f
f.dup.close_write
else
sleep 1
end
}
=> ruby 1.6.7 (2002-03-01) [i586-linux]
-:3:in `close_write': closing non-duplex IO for writing (IOError)......修正さ
れました。((<ruby-bugs-ja:PR#223>))
trap(:TERM, "EXIT")
END{
puts "exit"
}
Thread.start { Thread.stop }
sleep
: 2002-04-17: Regexp#inspect
((<ruby-bugs-ja:PR#222>))
p %r{\/}
=> ruby 1.6.7 (2002-03-01) [i586-linux]
/\\//
=> ruby......の戻り値
以下のメソッドの戻り値が正しくなりました。((<ruby-bugs-ja:PR#205>))
* ((<Enumerable/each_with_index>)) が self を返すようになった(以前は nil)
* ((<Process/Process.setpgrp>)) が返す値が不定だった。
* ((<String/ljust>)), ((<String/rju... -
Thread
# run -> self (113.0) -
停止状態(stop)のスレッドを再開させます。 Thread#wakeup と異なりすぐにスレッドの切り替え を行います。
...。
@raise ThreadError 死んでいるスレッドに対して実行すると発生します。
//emlist[例][ruby]{
a = Thread.new { puts "a"; Thread.stop; puts "c" }
sleep 0.1 while a.status!='sleep'
puts "Got here"
a.run
a.join
# => a
# => Got here
# => c
//}
@see Thread#wakeup, Thread.stop... -
Thread
# wakeup -> self (113.0) -
停止状態(stop)のスレッドを実行可能状態(run)にします。
...を実行可能状態(run)にします。
@raise ThreadError 死んでいるスレッドに対して実行すると発生します。
//emlist[例][ruby]{
c = Thread.new { Thread.stop; puts "hey!" }
sleep 0.1 while c.status!='sleep'
c.wakeup
c.join
# => "hey!"
//}
@see Thread#run, Thread.stop... -
Thread
:: ConditionVariable # broadcast -> self (113.0) -
状態変数を待っているスレッドをすべて再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。
...開します。再開された
スレッドは Thread::ConditionVariable#wait
で指定した mutex のロックを試みます。
@return 常に self を返します。
//emlist[例][ruby]{
mutex = Mutex.new
cv = ConditionVariable.new
flg = true
3.times {
Thread.start {
mutex.synchronize {......puts "a1"
while (flg)
cv.wait(mutex)
end
puts "a2"
}
}
}
Thread.start {
mutex.synchronize {
flg = false
cv.broadcast
}
}
sleep 1
# => a1
# => a1
# => a1
# => a2
# => a2
# => a2
//}... -
Thread
:: ConditionVariable # signal -> self (113.0) -
状態変数を待っているスレッドを1つ再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。
...開します。再開された
スレッドは Thread::ConditionVariable#wait
で指定した mutex のロックを試みます。
@return 常に self を返します。
//emlist[例][ruby]{
mutex = Mutex.new
cv = ConditionVariable.new
flg = true
3.times {
Thread.start {
mutex.synchronize {......puts "a1"
while (flg)
cv.wait(mutex)
end
puts "a2"
}
}
}
Thread.start {
mutex.synchronize {
flg = false
cv.signal
}
}
sleep 1
# => a1
# => a1
# => a1
# => a2
//}...