[erlang-questions] supervisors & slow init's

David Welton <>
Thu Dec 5 14:19:59 CET 2013


> Fire up the supervisor tree as fast as possible, then do the connectivity. A
> good example is how mnesia does it. You have to call
> mnesia:wait_for_tables/1,2 in order to wait for tables to come online, but
> the bootup of mnesia itself is very fast. So in your case, you would call:
> hardware:wait_ready(arduino, 8000) to wait at most 8000ms for the arduino to
> come online and so on.
>
> There is a recent post by Fred Hebert on this subject,
>
> http://ferd.ca/it-s-about-the-guarantees.html
>
> you might want to read as well.

I already read it - it's a great post, as usual.

However, perhaps I have not spelled out my problem very well.

We have several bits of C code in external processes - let's call them
A, B and C to be creative.  A starts, and does some stuff.  It's kind
of slow to do it, so it'd be easy enough to just start it, and
handle_info in the gen_server that supervises it to find out when it's
really ready.  But B and C cannot start until A is ready.  So A should
send messages to them, too?  I can see how to do it, but it all seems
kind of complicated compared to just letting them start in the order
they are supposed to start in, one after the other.

-- 
David N. Welton

http://www.welton.it/davidw/

http://www.dedasys.com/



More information about the erlang-questions mailing list