[erlang-questions] Managing children

Bob Cowdery <>
Mon Oct 17 10:19:10 CEST 2011


On 16/10/2011 21:15, Mihai Balea wrote:
> On Oct 16, 2011, at 3:54 PM, Bob Cowdery wrote:
>
>> Hi
>>
>> I have an OTP system with one supervisor that starts 7 processes. When
>> all processes are running I need to do some initialisation by sending
>> event messages from an ets database.
>>
>> What would be the appropriate way to achieve this. I don't see anything
>> specifically in supervisor that helps.
>>
>> 1. I could make the last process to start make the call, but that's a fudge.
>> 2. I could send a message from every process at the end of its init/1 to
>> a monitor process and get it to make the call when everything has
>> started, but that seems like duplicating supervisor function.
>> 3. I could run a process inside my supervisor module to either do what
>> (2) does or maybe call count_children/1 until I see all processes active.
>>
>> Is there some reason why supervisor does not have callbacks for managing
>> children.
> The supervisor's start_link function will only return {ok, pid()} when all children are up and running.
> You can start sending your event messages after that.
Ok, thanks. That did the trick.

Bob
> Mihai
>




More information about the erlang-questions mailing list