[erlang-questions] terminate child under simple one for one supervisor

Zoltan Lajos Kis kiszl@REDACTED
Thu Aug 20 10:14:01 CEST 2009


Hi,

That kind of child management is not possible with a simple_one_for_one 
supervisor:
"The functions terminate_child/2, delete_child/2 and restart_child/2 are 
invalid for simple_one_for_one supervisors and will return 
{error,simple_one_for_one} if the specified supervisor uses this restart 
strategy." (http://www.erlang.org/doc/man/supervisor.html)

If you need this, you can start a "regular" one_for_one supervisor with 
no initial children, and add the gen_fsm's later. Just be sure to use 
unique idenifiers for each them.

Regards,
Zoltan.


Thilani Abeysinghe wrote:
> hi,
> I have created following supervision tree.
>
> Sup1(one for all)  Under Sup1 there is Sup2(simple one for one)  and a
> gen_server Gen1(gen_server).
> Under Sup2(simple one for one) there is another gen_server.
> Gen2(gen_server).
>
> child is added by Gen1 calling supervisor:start_child(_,_)
>
> Gen2 starting successfuly.
> I want to know is there a way to stop the Gen2 gen_server.
> tried to use
> supervisor:terminate_child(SupRef, Id)
> it returned  {error,simple_one_for_one}
>
>
> ~Thilani Abeysinghe
>
>   



More information about the erlang-questions mailing list