Hi Wes - you should call a_sup:start_a instead of a_sup:start when trying to start a2.<div>Regards</div><div>/siri<br><br><div class="gmail_quote">2011/4/1 Wes James <span dir="ltr"><<a href="mailto:comptekki@gmail.com">comptekki@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5">Siri,<br>
<br>
The same thing happens:<br>
<br>
Erlang R14B02 (erts-5.8.3) [source] [smp:2:2] [rq:2] [async-threads:0]<br>
[hipe] [kernel-poll:false]<br>
<br>
Eshell V5.8.3  (abort with ^G)<br>
1> make:all([load]).<br>
Recompile: a_sup<br>
Recompile: a_sup_2<br>
up_to_date<br>
2> application:start(a).<br>
a1<br>
ok<br>
3> appmon:start().<br>
{ok,<0.49.0>}<br>
4> a_sup:start(a_sup_2,a2).<br>
{error,{already_started,<0.46.0>}}<br>
<br>
looking at appmon, there is an a_sup process supervising process<br>
<0.47.0> which I'm guessing is the a_sup_2. What I'm trying to do is<br>
run a_sup_2 with say name a1, then run a second a_sup_2, with say name<br>
a2 as if you were running a_sup_2 then then running register("a_sup_2<br>
process", a1) and then run a second a_sup_2 and get a second <0.xx.0><br>
process to do register(<0.xx.0>, a2) and so forth so several a_sup_2's<br>
can be running but with a different registered name.  Can that be<br>
done?<br>
<br>
thx,<br>
<br>
-wes<br>
<br>
</div></div><div><div></div><div class="h5">On Fri, Apr 1, 2011 at 3:48 AM, Siri Hansen <<a href="mailto:erlangsiri@gmail.com">erlangsiri@gmail.com</a>> wrote:<br>
> Attached you can find my small sample.  Please have a look and let me know<br>
> what differs.<br>
> Just to add some confusion, my a_sup corresponds to your eapp_sup and my<br>
> a_sup_2 corresponds to your a_sup.... ;)<br>
> /siri<br>
><br>
> 2011/3/31 Wes James <<a href="mailto:comptekki@gmail.com">comptekki@gmail.com</a>><br>
>><br>
>> Siri,<br>
>><br>
>> The code is from last weeks training part of the Erlang Factory in San<br>
>> Francisco.  I don't know if Erlang Solutions would like me sending all<br>
>> the code to people or not.  I'd send it to you off-list if it was ok<br>
>> with them.<br>
>><br>
>> Or maybe you could send me a sample of your code to compare with what I<br>
>> have.<br>
>><br>
>> thx,<br>
>><br>
>> -wes<br>
>><br>
>> On Thu, Mar 31, 2011 at 2:16 AM, Siri Hansen <<a href="mailto:erlangsiri@gmail.com">erlangsiri@gmail.com</a>> wrote:<br>
>> > Hi Wes,<br>
>> > It should be possible to do exactly what you want. I have tried to<br>
>> > recreate<br>
>> > your problem, but I did not succeed. If you want to you may post the<br>
>> > code<br>
>> > for the two supervisors and I will have a look at it to see what I'm<br>
>> > doing<br>
>> > different.<br>
>> > Regards<br>
>> > /siri<br>
>> ><br>
>> ><br>
>> > 2011/3/30 Wes James <<a href="mailto:comptekki@gmail.com">comptekki@gmail.com</a>><br>
>> >><br>
>> >> when I start and app that works fine:<br>
>> >><br>
>> >> =PROGRESS REPORT==== 30-Mar-2011::11:28:05 ===<br>
>> >>          supervisor: {local,eapp_sup}<br>
>> >>             started: [{pid,<0.70.0>},<br>
>> >>                       {name,{a_sup,a1}},<br>
>> >>                       {mfargs,{a_sup,start_link,[a1]}},<br>
>> >>                       {restart_type,permanent},<br>
>> >>                       {shutdown,brutal_kill},<br>
>> >>                       {child_type,supervisor}]<br>
>> >><br>
>> >> In eapp_sup I have:<br>
>> >><br>
>> >> start_a(Module, Name) -><br>
>> >>        supervisor:start_child(?MODULE, child(Module, Name)).<br>
>> >><br>
>> >><br>
>> >> child(Module, Name) -><br>
>> >>  {{Module, Name}, {Module, start_link, [Name]}, permanent,<br>
>> >> brutal_kill, supervisor, [Name]}.<br>
>> >><br>
>> >><br>
>> >> from starting above it would seem that a_sup has the name a1, but if<br>
>> >> you run appmon it shows just as a_sup.<br>
>> >><br>
>> >> When I then run<br>
>> >><br>
>> >> eapp:start_a(a_sup,a2).  I would assume that a_sup could load as a<br>
>> >> second supervisor process with name a2, but this is what I get:<br>
>> >><br>
>> >> eapp_sup:start_a(a_sup,a2).<br>
>> >> {error,{already_started,<0.70.0>}}<br>
>> >><br>
>> >> I then create a_sup2  and eapp_sup:start_a(a_sup2, a1) and that loads<br>
>> >> fine, since the module "name" is not the same in the system as a_sup.<br>
>> >> But it seems like a name should be assigned to these to make them<br>
>> >> unique by name and be able to use the same supervisor code to<br>
>> >> supervise some more children.<br>
>> >><br>
>> >> Is that possible?<br>
>> >><br>
>> >> thx,<br>
>> >><br>
>> >> -wes<br>
>> >> _______________________________________________<br>
>> >> erlang-questions mailing list<br>
>> >> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>> >> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br></div>