Shutting down a simple child

Vance Shipley <>
Tue Jun 29 18:28:20 CEST 2004

It seems that the main loop of gen_server (a supervisor is a 
gen_server) traps {'EXIT', Parent, Reason} and runs the 
terminate function.  So to shutdown the child with the same
method you would need to send an EXIT message with the pid
of the supervisor.

	{ok, SuperSuper} = supervisor:start_link(supersuper, []),
	{ok, Super} = supervisor:start_child(SuperSuper, []),
	Super ! {'EXIT', SuperSuper, shutdown}.

Hmmm ... is that bad form?


More information about the erlang-questions mailing list