78件ヒット
[1-78件を表示]
(0.121秒)
ライブラリ
- ビルトイン (72)
-
shell
/ process-controller (6)
クラス
-
Shell
:: ProcessController (6) - SignalException (24)
- Thread (48)
検索結果
先頭5件
-
Thread
# kill -> self (15114.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!... -
Shell
:: ProcessController # kill _ job(signal , command) -> Integer (9108.0) -
指定されたコマンドにシグナルを送ります。
...。
@param signal シグナルを整数かその名前の文字列で指定します。
負の値を持つシグナル(あるいはシグナル名の前に-)を指定すると、
プロセスではなくプロセスグループにシグナルを送ります。
@param c......ommand コマンドを指定します。
@see Process.#kill... -
SignalException
# signo -> Integer (3019.0) -
self のシグナル番号を返します。
...self のシグナル番号を返します。
//emlist[例][ruby]{
p Signal.signame(1) # => "HUP"
begin
Process.kill('HUP', Process.pid)
sleep
rescue SignalException => e
p e.signo # => 1
end
//}... -
SignalException
# signm -> String (3007.0) -
self.message のエイリアスです。
...self.message のエイリアスです。
//emlist[例][ruby]{
begin
Process.kill('HUP', Process.pid)
sleep
rescue SignalException => e
puts e.signm # => SIGHUP
end
//}... -
Thread
# value -> object (19.0) -
スレッド self が終了するまで待ち(Thread#join と同じ)、 そのスレッドのブロックが返した値を返します。スレッド実行中に例外が 発生した場合には、その例外を再発生させます。
...read#kill によって終了した場合は、返り値は不定です。
以下は、生成したすべてのスレッドの終了を待ち結果を出力する例です。
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| p t.value}
最後の行で、待ち合わせを行っていることがわかりにくいと思うなら以下
のように書くこともできます。
threads.each {|t| p t.join.value}... -
Thread
# exit -> self (14.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 (14.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!...