English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Erlang プロセス whereis メソッド

Erlang プロセス

これは whereis (Name) と呼ばれています。名前で登録されたプロセスの pid を返します。

文法

whereis(atom,pid)

引数

  • アトム −これはそのプロセスに割り当てる登録名です。

返り値

アトムにバインドされたプロセスID。

-module(helloworld). 
-export([start/0, call/2]). 
call(Arg1, Arg2) -> 
   io:fwrite("~p~n",[Arg1]). 
start() -> 
   Pid = spawn(?MODULE, call, ["hello", "process"]), 
   register(myprocess, Pid), 
   io:fwrite("~p~n",[whereis(myprocess)]).

上記のプログラムを実行すると、以下のような結果が得られます。

<0.55.0>
"hello"

Erlang プロセス