[erlang-questions] question: gen_event problems with add_sup_handler() and swap_sup_handler()
Wed Jan 16 09:17:25 CET 2008
I had this understanding when read the article, but that was not clear
at all. If you look at the code in the article, you'll see that
gen_event:swap_sup_handler() was called in the my_alarm_handler module
not from the guard process. That was confusing for me at least.
I'll test it now.
On Jan 16, 2008 1:33 AM, Ulf Wiger <> wrote:
> That tutorial pretty much explains it, I think, but perhaps
> it's a bit terse on some points.
> The whole point is that when the handler crashes,
> the gen_event process sends a message to the
> process that called add_sup_handler() in the first
> place. The supervising process /could/ simply
> reinstall the handler, but it would then have to
> be aware of recurring crashes. Since there is already
> a library that does so, it's better to simply let the
> supervising process die - it is supervised in its turn,
> and its supervisor will restart it. When this happens,
> the handler will be reinstalled.
> Ulf W
> 2008/1/15, Ahmed Ali <>:
> > Hi,
> > I've been trying for sometime to find a way to supervise
> > event_handlers in gen_event behaviour with no luck. I found the
> > following article and tried the code in it but it does not appear to
> > be right http://www.trapexit.org/Gen_event_behavior_demystified.
> > Can anyone please explain how add_sup_handler and swap_sup_handler
> > work and how I could get my event_handler to get restarted in case of
> > a crash?
> > Best regards,
> > Ahmed
> > _______________________________________________
> > erlang-questions mailing list
> > http://www.erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions