<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Dear Peter,</p>
    <p>as I see it, this code is just an example that shows how to
      initialize a custom process/module</p>
    <p>which adheres to OTP.</p>
    <p>The function do_initialization() is just a placeholder and
      depends on the topic of your module.</p>
    <p>This could be anything from contacting a database to initializing
      an I2C link.</p>
    <p>Here it is only known that it either returns ok or {error,
      Reason}. Based on this, the startup</p>
    <p>either succeeds or fails.</p>
    <p><br>
    </p>
    <p>In general, if you are looking for examples, I suggest to search
      on github or similar, something like</p>
    <p><a class="moz-txt-link-freetext" href="https://github.com/search?q=proc_lib%3Ainit_ack&type=commits">https://github.com/search?q=proc_lib%3Ainit_ack&type=commits</a></p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p>Kind regards,</p>
    <p>Dieter</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 01.01.21 06:32, Peter J Etheridge
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:b1f14326b1901414daa8c815c5fbc0cd2053038a@webmail.iinet.net.au">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div>Dear Fellow Erlangers,</div>
      <div><br>
      </div>
      <div>In proc_lib module this example includes a function in the
        case statement;</div>
      <div><br>
      </div>
      <div>
        <pre><span class="hljs-keyword">-module</span><span class="hljs-params">(my_proc)</span>.
<span class="hljs-keyword">-export</span><span class="hljs-params">([start_link/<span class="hljs-number">0</span>])</span>.
<span class="hljs-keyword">-export</span><span class="hljs-params">([init/<span class="hljs-number">1</span>])</span>.

<span class="hljs-function"><span class="hljs-title">start_link</span><span class="hljs-params">()</span> -></span>
    proc_lib:start_link(my_proc, init, [self()])

<span class="hljs-function"><span class="hljs-title">init</span><span class="hljs-params">(Parent)</span> -></span>
    <span class="hljs-keyword">case</span> do_initialization() <span class="hljs-keyword">of</span>
        ok ->
            proc_lib:init_ack(Parent, {ok, self()});
        {error, Reason} ->
            exit(Reason)
    <span class="hljs-keyword">end</span>,
    loop().


could someone kindly direct me to an example of a

do_initialization()

function?

thank you in advance,

Peter
</pre>
      </div>
      <br>
      <br>
    </blockquote>
  </body>
</html>