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

Roberto Aloi roberto.aloi@REDACTED
Mon Oct 19 19:23:02 CEST 2009

Hi Pablo,

what you actually need is an event handler. More information here:

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

Roberto Aloi

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

More information about the erlang-questions mailing list