[erlang-questions] OTP Supervisor Question

Angel Alvarez clist@REDACTED
Mon Jan 4 13:12:36 CET 2010


El Lunes, 4 de Enero de 2010 04:12:40 Chandru escribió:
> 2010/1/4 Jayson Vantuyl <kagato@REDACTED>
> 
> > If I'm an OTP-style process (say, a gen_server), and I want to know who my
> > parent is (say, a supervisor), is this possible using any API, or do I need
> > to pass in the Parent explicitly?  Is using supervisor:get_child a good way
> > to find a process's sibling?  Would it be better to start a single
> > gen_server and have it use normal, linked processes?
> >
> 
> I think using supervisor:which_children(Sup_ref)  is quite reasonable. But
> for this, you'll have to store the process id of the supervisor in all the
> supervised processes.
> 
> 
> >
> > I have a certain automaton that is represented as a group of three
> > processes.  These processes coordinate and there may be multiple automata on
> > a single node.  I want to put them under a single supervisor, but I'm
> > struggling a bit to get them to all know each other's PIds without adding
> > code to the supervisor (which is bad, right?) and without having to locally
> > register them (which would prevent multiple automata per node).
> >
> 
> As far as I understand, you'll need a two level supervision tree. One
> supervisor supervising each set of three processes, and those supervisors in
> turn under a top level supervisor. That way, when any of a set of three
> processes invoke supervisor:which_children(Sup_ref) on its supervisor, it'll
> only see that set and nothing else.
> 
> Chandru
> 
Try aplication docs, maybe thereis some function to traverse aplication supervisors...


-- 
Este correo no tiene dibujos. Las formas extrañas en la pantalla son letras.
__________________________________________

Clist UAH a.k.a Angel
__________________________________________
El Universo es una de esas cosas que sucede de vez en cuando...


More information about the erlang-questions mailing list