How do you stop a supervisor?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How do you stop a supervisor?

Joe Williams-2

Is there an approved way to stop a supervisor?

Apart from just killing it that is.

/Joe

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





Reply | Threaded
Open this post in threaded view
|

How do you stop a supervisor?

Ulf Wiger-4
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