[erlang-questions] question: gen_event problems with add_sup_handler() and swap_sup_handler()
Tue Jan 15 22:33:05 CET 2008
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.
2008/1/15, Ahmed Ali <ahmed.nawras@REDACTED>:
> 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,
> erlang-questions mailing list
More information about the erlang-questions