Erlang – unregister

Erlang unregister

In this guide, we will discuss Erlang unregister. This is used to unregister a process in the system.

Syntax

unregister(atom)

Parameters

  • atom − This is the registered name to give to the process.

Return Value

None

For example

-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)]).

Output

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

<0.55.0>
"hello"
Undefined

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply