/doc/core/z_supervisor.html
http://github.com/zotonic/zotonic · HTML · 135 lines · 113 code · 22 blank · 0 comment · 0 complexity · 9d45aae29c8490928f8707090f08b01f MD5 · raw file
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>Module z_supervisor</title>
- <link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
- </head>
- <body bgcolor="white">
- <div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
- <hr>
- <h1>Module z_supervisor</h1>
- <ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>Supervisor with a one_for_one strategy and disabling of too-often-crashing resources.
- <p>Copyright 2010 Marc Worrell</p>
- <p><b>Behaviours:</b> <a href="gen_server.html"><tt>gen_server</tt></a>.</p>
- <p><b>Authors:</b> Marc Worrell (<a href="mailto:marc@worrell.nl"><tt>marc@worrell.nl</tt></a>).</p>
- <h2><a name="description">Description</a></h2>Supervisor with a one_for_one strategy and disabling of too-often-crashing resources.
- All children of this supervisor should be gen_server/supervisor processes.
- <h2><a name="index">Function Index</a></h2>
- <table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add_child-2">add_child/2</a></td><td>Add a child, the child will be added and started.</td></tr>
- <tr><td valign="top"><a href="#check_children-1">check_children/1</a></td><td>Check children, try restarting children when they are in 'error' state.</td></tr>
- <tr><td valign="top"><a href="#code_change-3">code_change/3</a></td><td>Convert process state when code is changed.</td></tr>
- <tr><td valign="top"><a href="#delete_child-2">delete_child/2</a></td><td>Delete a child, the child will be terminated and removed.</td></tr>
- <tr><td valign="top"><a href="#handle_call-3">handle_call/3</a></td><td>Add a child in the stopped state.</td></tr>
- <tr><td valign="top"><a href="#handle_cast-2">handle_cast/2</a></td><td>Stop a child process and add it to the stopped list.</td></tr>
- <tr><td valign="top"><a href="#handle_info-2">handle_info/2</a></td><td>Handle the exit of a child.</td></tr>
- <tr><td valign="top"><a href="#init-1">init/1</a></td><td>Initiates the server.</td></tr>
- <tr><td valign="top"><a href="#restart_child-2">restart_child/2</a></td><td>Terminate and restart a child.</td></tr>
- <tr><td valign="top"><a href="#running_children-1">running_children/1</a></td><td>Return the list of running children.</td></tr>
- <tr><td valign="top"><a href="#set_manager_pid-2">set_manager_pid/2</a></td><td>Set the manager pid for this supervisor.</td></tr>
- <tr><td valign="top"><a href="#start_child-2">start_child/2</a></td><td>Start a child when it is not running (either failed or stopped).</td></tr>
- <tr><td valign="top"><a href="#start_link-1">start_link/1</a></td><td></td></tr>
- <tr><td valign="top"><a href="#start_link-2">start_link/2</a></td><td></td></tr>
- <tr><td valign="top"><a href="#stop_child-2">stop_child/2</a></td><td>Stop a child, the child will be terminated and put in "stopped" state.</td></tr>
- <tr><td valign="top"><a href="#terminate-2">terminate/2</a></td><td>This function is called by a gen_server when it is about to
- terminate.</td></tr>
- <tr><td valign="top"><a href="#which_children-1">which_children/1</a></td><td>Return the list of all children and their run state.</td></tr>
- </table>
- <h2><a name="functions">Function Details</a></h2>
- <h3 class="function"><a name="add_child-2">add_child/2</a></h3>
- <div class="spec">
- <p><tt>add_child(Pid, ChildSpec) -> any()</tt></p>
- </div><p>Add a child, the child will be added and started.</p>
- <h3 class="function"><a name="check_children-1">check_children/1</a></h3>
- <div class="spec">
- <p><tt>check_children(Pid) -> any()</tt></p>
- </div><p>Check children, try restarting children when they are in 'error' state.</p>
- <h3 class="function"><a name="code_change-3">code_change/3</a></h3>
- <div class="spec">
- <p><tt>code_change(OldVsn, State, Extra) -> {ok, NewState}</tt></p>
- </div><p>Convert process state when code is changed</p>
- <h3 class="function"><a name="delete_child-2">delete_child/2</a></h3>
- <div class="spec">
- <p><tt>delete_child(Pid, Name) -> any()</tt></p>
- </div><p>Delete a child, the child will be terminated and removed.</p>
- <h3 class="function"><a name="handle_call-3">handle_call/3</a></h3>
- <div class="spec">
- <p><tt>handle_call(Message::Request, From, State) -> {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}</tt></p>
- </div><p>Add a child in the stopped state.</p>
- <h3 class="function"><a name="handle_cast-2">handle_cast/2</a></h3>
- <div class="spec">
- <p><tt>handle_cast(Message, State) -> any()</tt></p>
- </div><p>Stop a child process and add it to the stopped list.</p>
- <h3 class="function"><a name="handle_info-2">handle_info/2</a></h3>
- <div class="spec">
- <p><tt>handle_info(Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}</tt></p>
- </div><p>Handle the exit of a child</p>
- <h3 class="function"><a name="init-1">init/1</a></h3>
- <div class="spec">
- <p><tt>init(InitialChildren::Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}</tt></p>
- </div><p>Initiates the server.</p>
- <h3 class="function"><a name="restart_child-2">restart_child/2</a></h3>
- <div class="spec">
- <p><tt>restart_child(Pid, Name) -> any()</tt></p>
- </div><p>Terminate and restart a child.</p>
- <h3 class="function"><a name="running_children-1">running_children/1</a></h3>
- <div class="spec">
- <p><tt>running_children(Pid) -> any()</tt></p>
- </div><p>Return the list of running children</p>
- <h3 class="function"><a name="set_manager_pid-2">set_manager_pid/2</a></h3>
- <div class="spec">
- <p><tt>set_manager_pid(Pid, ManagerPid) -> any()</tt></p>
- </div><p>Set the manager pid for this supervisor</p>
- <h3 class="function"><a name="start_child-2">start_child/2</a></h3>
- <div class="spec">
- <p><tt>start_child(Pid, Name) -> any()</tt></p>
- </div><p>Start a child when it is not running (either failed or stopped)</p>
- <h3 class="function"><a name="start_link-1">start_link/1</a></h3>
- <div class="spec">
- <p><tt>start_link(Args) -> any()</tt></p>
- </div>
- <h3 class="function"><a name="start_link-2">start_link/2</a></h3>
- <div class="spec">
- <p><tt>start_link(SupName, Args) -> any()</tt></p>
- </div>
- <h3 class="function"><a name="stop_child-2">stop_child/2</a></h3>
- <div class="spec">
- <p><tt>stop_child(Pid, Name) -> any()</tt></p>
- </div><p>Stop a child, the child will be terminated and put in "stopped" state</p>
- <h3 class="function"><a name="terminate-2">terminate/2</a></h3>
- <div class="spec">
- <p><tt>terminate(Reason, State) -> <a href="#type-void">void()</a></tt></p>
- </div><p>This function is called by a gen_server when it is about to
- terminate. It should be the opposite of Module:init/1 and do any necessary
- cleaning up. When it returns, the gen_server terminates with Reason.
- The return value is ignored.</p>
- <h3 class="function"><a name="which_children-1">which_children/1</a></h3>
- <div class="spec">
- <p><tt>which_children(Pid) -> any()</tt></p>
- </div><p>Return the list of all children and their run state.</p>
- <hr>
- <div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
- <p><i>Generated by EDoc, Oct 13 2011, 14:45:56.</i></p>
- </body>
- </html>