るりまサーチ (Ruby 2.4.0)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.102秒)
トップページ > クエリ:-[x] > バージョン:2.4.0[x] > クエリ:|[x] > クエリ:at[x] > クエリ:fork[x] > モジュール:Kernel[x]

別のキーワード

  1. _builtin |
  2. set |
  3. ipaddr |
  4. array |
  5. integer |

ライブラリ

検索結果

Kernel.#fork -> Integer | nil (55054.0)

fork(2) システムコールを使ってプロセスの複製を作 ります。親プロセスでは子プロセスのプロセスIDを、子プロセスでは nil を返します。ブロックを指定して呼び出した場合には、生成し た子プロセスでブロックを評価します。

...puts "parent process. pid: #{Process.pid}, child pid: #{child_pid}"
# => parent process. pid: 79055, child pid: 79602

# 親プロセスでの処理
# ...

# 子プロセスの終了を待って終了。
Process.waitpid(child_pid)
//}


@see IO.popen,IO.pipe,Kernel.#at_exit,Kernel.#exit!, fork(2)...

Kernel.#fork { ... } -> Integer | nil (55054.0)

fork(2) システムコールを使ってプロセスの複製を作 ります。親プロセスでは子プロセスのプロセスIDを、子プロセスでは nil を返します。ブロックを指定して呼び出した場合には、生成し た子プロセスでブロックを評価します。

...puts "parent process. pid: #{Process.pid}, child pid: #{child_pid}"
# => parent process. pid: 79055, child pid: 79602

# 親プロセスでの処理
# ...

# 子プロセスの終了を待って終了。
Process.waitpid(child_pid)
//}


@see IO.popen,IO.pipe,Kernel.#at_exit,Kernel.#exit!, fork(2)...

Kernel.#at_exit { ... } -> Proc (18823.0)

与えられたブロックをインタプリタ終了時に実行します。

...Proc オブジェクトで返します。

//emlist[例][ruby]{
3.times do |i|
at_exit{puts "at_exit#{i}"}
end
END{puts "END"}
at_exit{puts "at_exit"}
puts "main_end"

#=> main_end
# at_exit
# END
# at_exit2
# at_exit1
# at_exit0
//}

@see d:spec/control#END,Kernel.#exit!,Kernel.#fork...