Skip to content

Instantly share code, notes, and snippets.

@elbrujohalcon
Last active September 26, 2017 02:28
Show Gist options
  • Save elbrujohalcon/f9753387a98a798ea829a0bd262522ec to your computer and use it in GitHub Desktop.
Save elbrujohalcon/f9753387a98a798ea829a0bd262522ec to your computer and use it in GitHub Desktop.
Maybe Supervisor
-module(maybe_sup).
-behaviour(supervisor).
-export([start/0, stop/0]).
-export([init/1]).
%% EXTERNAL API ------------------------------------------------------------------------------------
start() -> supervisor:start_link({local, ?MODULE}, ?MODULE, #{}).
stop() ->
gen_server:stop(?MODULE).
%% CALLBACKS ---------------------------------------------------------------------------------------
init(#{}) ->
SupFlags = #{strategy => one_for_one},
ChildSpecs = [#{ id => maybe_server
, start => {maybe_server, start_link, []}
}],
{ok, {SupFlags, ChildSpecs}}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment