How do you stop a supervisor?

Ulf Wiger etxuwig@REDACTED
Tue Jun 3 15:20:23 CEST 2003


On Tue, 3 Jun 2003, Joe Armstrong wrote:

>
>Is there an approved way to stop a supervisor?


The parent calling exit(Child, shutdown).
There is no other clean way to do it.


>Apart from just killing it that is.

Doing exit(Supervisor, kill) is not the approved way. This
will cause an {'EXIT', Supervisor, killed} message to
propagate to the children, which will be interpreted as an
error. Most likely the children will die too, but if they
follow the OTP behavioural rules (started with proc_lib,
etc.), you will get crash reports.


>(there is no stop call only an undocumented terminate/2)

terminate/2 is the gen_server callback, which is called if
the supervisor terminates due to a coding fault in the
supervisor. The supervisor.erl module is implemented as a
gen_server callback. Calling the terminate/2 function
directly will have quite unexpected consequences.

/Uffe
-- 
Ulf Wiger, Senior Specialist,
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson AB, Connectivity and Control Nodes




More information about the erlang-questions mailing list