From 978ccb1fc2de4abc2d0d6b89e664ea6d8da1c663 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Mon, 14 Nov 2011 15:39:45 +0100 Subject: Improve documentation on supervisor restart strategy --- lib/stdlib/doc/src/supervisor.xml | 61 +++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 22 deletions(-) (limited to 'lib/stdlib/doc') diff --git a/lib/stdlib/doc/src/supervisor.xml b/lib/stdlib/doc/src/supervisor.xml index 30514dfee9..cddb55e5c5 100644 --- a/lib/stdlib/doc/src/supervisor.xml +++ b/lib/stdlib/doc/src/supervisor.xml @@ -158,7 +158,7 @@ child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules} death causes the temporary process to be terminated) and a transient child process should be restarted only if it terminates abnormally, i.e. with another exit reason - than normal.

+ than normal, shutdown or {shutdown,Term}.

Shutdown defines how a child process should be @@ -355,14 +355,23 @@ child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules}

Tells the supervisor SupRef to terminate the given child.

+

If the supervisor is not simple_one_for_one, - Id must be the child specification identifier. The - process, if there is one, is terminated but the child - specification is kept by the supervisor. The child process - may later be restarted by the supervisor. The child process - can also be restarted explicitly by calling + Id must be the child specification + identifier. The process, if there is one, is terminated and, + unless it is a temporary child, the child specification is + kept by the supervisor. The child process may later be + restarted by the supervisor. The child process can also be + restarted explicitly by calling restart_child/2. Use delete_child/2 to remove the child specification.

+ +

If the child is temporary, the child specification is deleted as + soon as the process terminates. This means + that delete_child/2 has no meaning + and restart_child/2 can not be used for these + children.

+

If the supervisor is simple_one_for_one, Id must be the child process' pid(). I the specified process is alive, but is not a child of the given @@ -399,26 +408,34 @@ child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules} Restart a terminated child process belonging to a supervisor. -

Tells the supervisor SupRef to restart a child process - corresponding to the child specification identified by - Id. The child specification must exist and - the corresponding child process must not be running.

-

See start_child/2 for a description of - SupRef.

-

If the child specification identified by Id does not - exist, the function returns {error,not_found}. If - the child specification exists but the corresponding process - is already running, the function returns +

Tells the supervisor SupRef to restart + a child process corresponding to the child specification + identified by Id. The child + specification must exist and the corresponding child process + must not be running.

+

Note that for temporary children, the child specification + is automatically deleted when the child terminates, and thus + it is not possible to restart such children.

+

See start_child/2 + for a description of SupRef.

+

If the child specification identified + by Id does not exist, the function + returns {error,not_found}. If the child specification + exists but the corresponding process is already running, the + function returns {error,running}.

-

If the child process start function returns {ok,Child} - or {ok,Child,Info}, the pid is added to the supervisor - and the function returns the same value.

+

If the child process start function + returns {ok,Child} + or {ok,Child,Info}, the pid + is added to the supervisor and the function returns the same + value.

If the child process start function returns ignore, the pid remains set to undefined and the function returns {ok,undefined}.

-

If the child process start function returns an error tuple or - an erroneous value, or if it fails, the function returns - {error,Error} where Error is a term containing +

If the child process start function returns an error tuple + or an erroneous value, or if it fails, the function returns + {error,Error} + where Error is a term containing information about the error.

-- cgit v1.2.3