summaryrefslogtreecommitdiff
path: root/p11p-daemon/src/p11p_sup.erl
blob: 7f7025f0df2767f553d1526451bb5aab717f3f0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
%%% Copyright (c) 2019, Sunet.
%%% See LICENSE for licensing information.

-module(p11p_sup).
-behaviour(supervisor).

%% API.
-export([start_link/0]).

%% Supervisor callbacks.
-export([init/1]).

%% From supervisor.
-type start_link_err() :: {already_started, pid()} | shutdown | term().
-type start_link_ret() :: {ok, pid()} | ignore | {error, start_link_err()}.

-spec start_link() -> start_link_ret().
start_link() ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules}
-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
init([]) ->
    {ok, {{rest_for_one, 1, 5},
	  [
	   ?CHILD(p11p_config, worker),
	   ?CHILD(p11p_manager, worker),
	   ?CHILD(p11p_server_sup, supervisor)
	  ]}}.