[erlang-questions] [Code Review] Is this a good idea? I linking 3 process manually (not using recursive)

I Gusti Ngurah Oka Prinarjaya okaprinarjaya@REDACTED
Fri Mar 8 11:58:09 CET 2019


Hi Folks,

I need your help to review my code. I create and linking 3 process manually
without using recursive. And inside p1 and p2 i using IF statement to check
to make sure spawning process will only once.

I mean, is part code below is a good idea?


   1. IsPidExists = whereis(xxx),
   2.   if IsPidExists =:= undefined ->
   3.     Pid = spawn_link(?MODULE, the_p, []),
   4.     register(xxx, Pid);
   5.     true -> true
   6.   end,
   7.



This is my code https://pastebin.com/3MXcUNUp

Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190308/de8134df/attachment.htm>


More information about the erlang-questions mailing list