Erlang - is_pid



This method is used to determine if a process id exists.

Syntax

Is_pid(processid)

Parameters

  • processid − This is the process id which needs to be checked if it exists.

Return Value

Returns true if the process id exists else it will return 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

When we run the above program we will get the following result.

true"hello" "process"
erlang_processes.htm
Advertisements