它称为whereis(Name)。返回使用该名称注册的进程的pid。
whereis(atom,pid)
atom -这是要赋予该过程的注册名称。
绑定到原子的进程ID。
-module(helloLearnfk). -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)]).
运行上面代码输出
链接:https://www.learnfk.comhttps://www.learnfk.com/erlang/erlang-whereis.html
来源:LearnFk无涯教程网
当我们运行上述程序时,我们将得到以下输出。
<0.55.0> "hello"
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)