[erlang-questions] excute code in the supervisor when a child crashes?

Pablo Platt <>
Mon Oct 19 19:40:55 CEST 2009


Why having an even handler is better then just monitoring the child processes?
How will the event manager be informed of crashed child processes?




________________________________
From: Roberto Aloi <>
To: Pablo Platt <>
Cc: 
Sent: Mon, October 19, 2009 7:23:02 PM
Subject: Re: [erlang-questions] excute code in the supervisor when a child crashes?

Hi Pablo,

what you actually need is an event handler. More information here:
http://www1.erlang.org/doc/design_principles/events.html
http://www.erlang.org/doc/man/gen_event.html

One approach could be to append a handler process to your supervisor, managing the ets table whenever one of the children crash.
Regards,

Roberto Aloi

http://www.erlang-consulting.com
---




On Oct 19, 2009, at 5:12 PM, Pablo Platt wrote:

> Hi,
> 
> I have a supervisor with simple_one_for_one.
> When I start children with supervisor:start_child I save the child pid in an ETS table
> so I'll be able to exchange messages between all the child processes.
> 
> When a child crashes I need to delete his pid from the ETS table or it'll grow constantly and eat all my memory.
> Is it possible to execute code when a child crashes or terminates?
> 
> Thanks
> 
> 


________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org


      


More information about the erlang-questions mailing list