erlang supervisor

定义supervisor时,如果是监控celuesimple_one_for_one则删除children的时候就用supervisor:terminate_child (SupModuleName, ChildPid),如果shutdown策略选择的是brutal_kill,那么supervisor会调用exit(ChildPid, kill),这样的话如果Child的behavior是gen_server,则不会调用他的terminate函数,而是直接退出。

如果shutdown策略选择的是数字(超时时间),那么supervisor会调用exit(ChildPid, shutdown),这样的话如果Child的behavior是gen_server,则会调用他的terminate函数,然后返回给supervisor一个exit回应信号,然后再退出。

猜你喜欢

转载自wudixiaotie.iteye.com/blog/2221656