在Cowboy github上提供的示例中,以及我在网上找到的一些其他示例中,有一对一的主管似乎什么也没做.我甚至认为我看到了一个有以下评论的例子,"就像真正的主管不做任何事情一样".
监督模块的目的似乎是如此众多的牛仔示例的一部分?
从echo_get示例:
%% Feel free to use, reuse and abuse the code in this file.
%% @private-module(echo_get_sup).
-behaviour(supervisor).
%% API.
-export([start_link/0]).
%% supervisor.
-export([init/1]).
%% API.
-spec start_link() -> {ok, pid()}.
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
%% supervisor.
init([]) ->
Procs = [],
{ok, {{one_for_one, 10, 10}, Procs}}.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
626 次 |
| 最近记录: |