目录

whereis

它被称为whereis(Name)。 返回使用名称注册的进程的pid。

语法 (Syntax)

whereis(atom,pid)

参数 (Parameters)

  • atom - 这是给进程的注册名称。

返回值 (Return Value)

进程id绑定到atom。

例如 (For example)

-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)]).

输出 (Output)

当我们运行上述程序时,我们将得到以下结果。

<0.55.0>
"hello"
↑回到顶部↑
WIKI教程 @2018