[erlang-questions] "Calling" question

Jack Moffitt jack@REDACTED
Sat May 28 01:04:53 CEST 2011


> supervisor:start_child(a) (calls into b, into c, into into d)
> or
> supervisor:start_child(d)...

The supervisor you make the call to is the one that starts the child
and monitors it, so you'll want to pick the supervisor that is
directly responsible not the top level one (unless those happen to be
one and the same).

Generally I had hide calls to supervisor:start_child/2 behind my
modules API. For example:

sw_bot:create(Config) will call supervisor:start_child(sw_bot_sup,
[Config]) (in this case it's a simple_one_for_one supervisor)

Now none of my code needs to know who the correct supervisor is except sw_bot.

jack.



More information about the erlang-questions mailing list