erlang application
3787 단어 application
The reason why I thought of talking about the app is mainly because there is still a problem about process registration that has not been solved, and I always want to know an exact result!
Here, let's assume we're doing a game. Let's take map_app.app as an example to write a configuration file. I really can't remember the parameters here. See other people's comments.
{application, map_app, %%app
[{description,"the application which createed the processes of map"},%%
{vsn,"2.0"}, %%
{modules,[]}, %% module,
{registered,[]}, %%
{maxP,Num}, %%
{maxT,Time}, %%app
{included_applications,[]} %% app
{env,[]} %%app env
{applications,[kernel,stdlib]}, %% application
{mod,{map_app,[]}} %%app
]
}.
Let's write the code to load the app-mdoule(map_app).
-behaviour(application).
-export([
start/2,
stop/1,
start/0
]).
start()->
application:start(?MODULE, permanent).
start(_Type, _StartArgs) ->
{ok, _MapSupPid} = start_map_sup().
stop(_State) ->
ok.
start_map_sup()->
case map_sup:start_link() of
{ok, Pid} ->
{ok, Pid};
Error ->
Error
end.
Here, the loading of the app, the application as a behavioral framework, it will automatically load start/0 and start/2, there is time to see how the source code operates, here we start a super, as a monitoring process, that is, the management Procedure. Used to monitor and manage processes started through it
Write the super code as well
-module(map_sup).
-behaviour(supervisor).
-export([start_link/0, init/1]).
start_link()->
supervisor:start_link({local,?MODULE}, ?MODULE, []).
init([]) ->
{ok,{{one_for_one,1000,2}, []}}.
At this point, we have written a small application, and we can start to slowly expand the program after testing.Recently, I found that although I have done a lot of erlang things in my work, I still have a lot of confusion when I look back. This is good, I can consolidate my foundation and correct my learning methods and attitudes.
I will extend the supervisor stuff to the next program tomorrow.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Pre-Query SamplesValidate the current query criteria or provide additional query criteria programmatically, just before sending the SELEC...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.