Browse Source

sup模板添加

master
AICells 4 years ago
parent
commit
2dfa33d12d
1 changed files with 41 additions and 0 deletions
  1. +41
    -0
      src/comMisc/template.erl

+ 41
- 0
src/comMisc/template.erl View File

@ -0,0 +1,41 @@
-module(template).
%% sup行为模块
-behaviour(supervisor).
-export([start_link/0]).
-export([init/1]).
-define(SERVER, ?MODULE).
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
%
% sup_flags() =
% #{
% strategy => strategy(), % optional one_for_one | one_for_all | rest_for_one | simple_one_for_one
% intensity => non_neg_integer(), % optional MaxR
% period => pos_integer() % optional MaxT MaxT里重启次数大于MaxR
% }
% child_spec() =
% #{
% id => child_id(), % mandatory Id用来内部标识子规范
% start => mfargs(), % mandatory {MFA}
% restart => restart(), % optional permanent() | transient( normal,shutdown,{shutdown,Term}) | temporary()
% shutdown => shutdown(), % optional brutal_kill | infinity | integer
% type => worker(), % optional supervisor | worker
% modules => modules() % optional [Module] supervisorgen_server gen_fsmModule gen_eventModules dynamic
% }
init([]) ->
SupFlags =
#{
strategy => one_for_all,
intensity => 0,
period => 1
},
ChildSpecs =
[],
{ok, {SupFlags, ChildSpecs}}.

Loading…
Cancel
Save