Erlang - whereis
Se llama whereis (Nombre). Devuelve el pid del proceso que está registrado con el nombre.
Sintaxis
whereis(atom,pid)
Parámetros
atom - Este es el nombre registrado para dar al proceso.
Valor devuelto
El ID de proceso vinculado al átomo.
Por ejemplo
-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)]).
Salida
Cuando ejecutamos el programa anterior, obtendremos el siguiente resultado.
<0.55.0>
"hello"