当前位置: 首页 > 文档资料 > Erlang 中文教程 >

is_pid

优质
小牛编辑
115浏览
2023-12-01

此方法用于确定进程ID是否存在。

语法 (Syntax)

Is_pid(processid)

参数 (Parameters)

  • processid - 这是需要检查的进程ID(如果存在)。

返回值 (Return Value)

如果进程id存在则返回true,否则返回false。

例如 (For example)

-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",[is_pid(Pid)]).

输出 (Output)

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

true"hello" "process"