erlang应用行为模式

来源:互联网 发布:舞台灯光软件 编辑:程序博客网 时间:2024/06/12 00:40

  每个主动应用都配有一个application行为模式的实现模块,用于实现系统启动逻辑,它至少要负责根监督者的启动,通常被命名为<application>_app

  主要有start/2与stop/1两个回调,示例:

-module(sc_app).-behaviour(application).-export([start/2, stop/1]).start(_StartType, _StartArgs) ->        {ok, Pid} ->            {ok, Pid};        Other ->            {error, Other}    end.stop(_State) ->    ok.


0 0
原创粉丝点击