title: Erlang. Correct way to stop process
body: <p>Good day, i have following setup for my little service:</p>
  
  <pre><code>-module(mrtask_net).
  
  -export([start/0, stop/0, listen/1]).
  
  -define(SERVER, mrtask_net).
  
  start() -&gt;
      Pid = spawn_link(fun() -&gt; ?MODULE:listen(4488) end),
      register(?SERVER, Pid),
      Pid.
  
  stop() -&gt;
      exit(?SERVER, ok).
  
  ....
  </code></pre>
  
  <p>And here is the repl excerpt:</p>
  
  <pre><code>(emacs@rover)83&gt; mrtask_net:start().
  &lt;0.445.0&gt;
  (emacs@rover)84&gt; mrtask_net:stop().
  ** exception error: bad argument
       in function  exit/2
          called as exit(mrtask_net,ok)
       in call from mrtask_net:stop/0
  (emacs@rover)85&gt; 
  </code></pre>
  
  <p>As you see, stopping process produces error, process is stopping though.
  What does this error mean and how to make thing clean ?</p>