Erlang - unregister 方法
这用于取消注册系统中的进程。
语法
unregister(atom)
参数
atom − 这是为进程提供的注册名称。
返回值
None
例如
-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)]),
unregister(myprocess),
io:fwrite("~p~n",[whereis(myprocess)]).
输出
当我们运行上面的程序时,我们将得到以下结果。
<0.55.0> "hello" Undefined

