English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Erlang process is_process_alive method

Processes in Erlang

This isis_process_alive(Pid). Pid must refer to a process on the local node. If the process exists and is active, it returns true, meaning that it does not matter whether the process has exited or not. Otherwise, it returns false.

Syntax

is_process_alive(processid)

Parameter

  • processid −This is the process ID, which needs to be checked for existence.

Return Value

  • Returns true —— if the process ID exists, it returns false.

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

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

true
"hello" "process"

Processes in Erlang