它被稱(chēng)為 whereis (Name)。返回用該名稱(chēng)注冊(cè)的進(jìn)程的 pid。
whereis(atom,pid)
atom ?這是要賦予該過(guò)程的注冊(cè)名稱(chēng)。
綁定到原子的進(jìn)程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)]).當(dāng)我們運(yùn)行上面的程序時(shí),我們將得到以下結(jié)果。
<0.55.0> "hello"