[erlang-questions] supervisor children's pid

Daniel Goertzen dang@REDACTED
Thu May 19 21:22:15 CEST 2011


Also +1 for gproc.

In your supervisor child specs, pass the supervisor's pid as a parameter to
each gen_server.  Then, have the gen_servers register themselves with gproc
as..

{SuperPid, child1}
{SuperPid, child2}
etc...

This way siblings can easily access each other even after child restarts,
and you can have many instances of your supervisor/gen_server tree without
registration collisions (which I suspect is why you avoided registration to
begin with.)

Also, see gproc:await() to synchronize startup with siblings.

Dan.

On Wed, May 18, 2011 at 7:45 AM, Tim Watson <watson.timothy@REDACTED>wrote:

> >>
> >>  * Run a name resolution server somewhere and have all the children
> >>    subscribe to it. The server will monitor them and may provide
> >>    notification facility to announce Pid changes/availability to
> >>    anyone interested -- this lets you do safe startup of dependent
> >>    processes.
> >
> > probably the best would be then to have a gen_event module for this. this
> is
> > a good idea.
> >
>
> wouldn't gproc be useful for this? The keys don't have to matter and
> you can subscribe based on a match/wildcard.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>



-- 
Daniel Goertzen
-----------------
dang@REDACTED (work)
daniel.goertzen@REDACTED (home)
-----------------
1 204 272 6149 (home/office)
1 204 470 8360 (mobile)
-----------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110519/fa414b0c/attachment.htm>


More information about the erlang-questions mailing list