[erlang-questions] supervisors

Wes James comptekki@REDACTED
Wed Mar 30 19:47:13 CEST 2011


when I start and app that works fine:

=PROGRESS REPORT==== 30-Mar-2011::11:28:05 ===
          supervisor: {local,eapp_sup}
             started: [{pid,<0.70.0>},
                       {name,{a_sup,a1}},
                       {mfargs,{a_sup,start_link,[a1]}},
                       {restart_type,permanent},
                       {shutdown,brutal_kill},
                       {child_type,supervisor}]

In eapp_sup I have:

start_a(Module, Name) ->
	supervisor:start_child(?MODULE, child(Module, Name)).


child(Module, Name) ->
  {{Module, Name}, {Module, start_link, [Name]}, permanent,
brutal_kill, supervisor, [Name]}.


from starting above it would seem that a_sup has the name a1, but if
you run appmon it shows just as a_sup.

When I then run

eapp:start_a(a_sup,a2).  I would assume that a_sup could load as a
second supervisor process with name a2, but this is what I get:

eapp_sup:start_a(a_sup,a2).
{error,{already_started,<0.70.0>}}

I then create a_sup2  and eapp_sup:start_a(a_sup2, a1) and that loads
fine, since the module "name" is not the same in the system as a_sup.
But it seems like a name should be assigned to these to make them
unique by name and be able to use the same supervisor code to
supervise some more children.

Is that possible?

thx,

-wes



More information about the erlang-questions mailing list