Erlang - désinscrire

Ceci est utilisé pour désenregistrer un processus dans le système.

Syntaxe

unregister(atom)

Paramètres

  • atom - C'est le nom enregistré à donner au processus.

Valeur de retour

Aucun

Par exemple

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

Production

Lorsque nous exécutons le programme ci-dessus, nous obtiendrons le résultat suivant.

<0.55.0>
"hello"
Undefined