[erlang-questions] order of processes in supervisor

bartek bartek@REDACTED
Wed Mar 21 12:55:37 CET 2012


On Wed, 21 Mar 2012 12:32:51 +0100
bartek <bartek@REDACTED> wrote:

> Hi
> 
> Is there a way to configure supervisor so that it makes sure its child
> processes are started in due order - meaning child B starts only after
> A started successfully and completed its initialization?
> 
> I have two processes of which one depends on the other, so I need to
> make sure that B is running only when A is running. I know can
> achieve it by monitoring, but I want them both supervised, and when
> they are being started by a supervisor B goes into a cyclic restart
> until A gets up, so this is not a clean solution. What is the right
> way to do it? Start B's supervisor from process A? Or use dynamic
> child creation somehow? But then a child process would have to get
> reference to its supervisor and call it after it is done - would it
> be kosher from OTP point of view?
> 
> Thanks
> Bartek Górny
> 


I read this one :) But the supervisor seems to trigger their startup
but not wait for it to complete. At least this is what I observed - my
child list is [A, B], and B in its init does "monitor(A)", and it
crashes.

B.


-- 
Co tu począć, co tu począć, trudna rada / Człowiek przestał się już
dobrze zapowiadać / Ale z drugiej strony można cieszyć się / Że się
również przestał zapowiadać źle... (Starsi Panowie)



More information about the erlang-questions mailing list