Erlang - pid_to_list 方法

它将进程 ID 转换为列表。

语法

Pid_to_list(processid)

参数

  • processid − 这是需要转换为列表的进程ID。

返回值

从进程 ID 返回列表。

例如

-module(helloworld). 
-export([start/0, call/2]). 

call(Arg1, Arg2) ->
   io:format("~p ~p~n", [Arg1, Arg2]). 

start() ->
   Pid = spawn(?MODULE, call, ["hello", "process"]), 
   io:fwrite("~p~n",[pid_to_list(Pid)]).

输出

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

"<0.55.0>"
"hello" "process"

❮ erlang_processes.html