[erlang-questions] otp supervisor terminate callback

Tim Watson <>
Wed Apr 24 14:56:53 CEST 2013


Good point, although that might cause unexpected info messages to be
delivered to the supervisor's mailbox if the handler is removed. AFAIR
that'll only cause some noise in the logs via error_logger though, so maybe
it's not a big deal.


On 24 April 2013 13:23, Danil Zagoskin <> wrote:

> If you need just to remove gen_event handler, use
> gen_event:add_sup_handler, and handler will be removed automatically when
> your process dies.
>
>
> 2013/4/20 Seven Du <>
>
>>  Hi,
>>
>> I'd like to know is it possible to have a terminate callback that clean
>> up things when the supervisor stops?
>>
>> Specifically I want to write an application which starts a supervisor,
>> and add a handler to some existing gen_event by calling
>> gen_event:add_handler() on init(), and I want to call
>> gen_event:remove_handler() when the application is stop. Is there an easy
>> way to do it?
>>
>> Thanks
>>
>> --
>> Seven Du
>> http://www.freeswitch.org.cn
>> http://about.me/dujinfang
>> http://www.dujinfang.com
>>
>> Sent with Sparrow <http://www.sparrowmailapp.com/?sig>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
>
> --
> ---------------------------------------------
> Данил Загоскин | +7 906 064 20 47 | 
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130424/8da7e22a/attachment.html>


More information about the erlang-questions mailing list