[erlang-questions] otp supervisor terminate callback

Tim Watson watson.timothy@REDACTED
Wed Apr 24 14:08:00 CEST 2013


Steven,

That isn't supported by the supervisor API. You'll need to create a child
process beneath the supervisor (using gen_server for example) and handle
the init/1 and terminate/2 behaviour there.


On 24 April 2013 11:49, Seven Du <dujinfang@REDACTED> wrote:

>  Thanks Vance. Maybe I didn't made clear, I want a terminate callback in
> the -behaviour(supervisor).
>
> --
> Seven Du
> http://www.freeswitch.org.cn
> http://about.me/dujinfang
> http://www.dujinfang.com
>
> Sent with Sparrow <http://www.sparrowmailapp.com/?sig>
>
> On Saturday, April 20, 2013 at 5:34 PM, Vance Shipley wrote:
>
> To get the terminate/1 callback in a gen_server or gen_fsm behaviour
> module what you would do is to set the process flag to trap exits in your
> init/1 callback.
> On Apr 20, 2013 4:34 PM, "Seven Du" <dujinfang@REDACTED> wrote:
>
>  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
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130424/8fdaacb5/attachment.htm>


More information about the erlang-questions mailing list