/src/erlv8_sup.erl

http://github.com/beamjs/erlv8 · Erlang · 27 lines · 9 code · 9 blank · 9 comment · 0 complexity · 3135e1bef895842edcdd189e4f3610cf MD5 · raw file

  1. -module(erlv8_sup).
  2. -behaviour(supervisor2).
  3. %% API
  4. -export([start_link/0]).
  5. %% Supervisor callbacks
  6. -export([init/1]).
  7. %% Helper macro for declaring children of supervisor
  8. -define(CHILD(I, Restart, Type), {I, {I, start_link, []}, Restart, 5000, Type, [I]}).
  9. %% ===================================================================
  10. %% API functions
  11. %% ===================================================================
  12. start_link() ->
  13. supervisor2:start_link({local, ?MODULE}, ?MODULE, []).
  14. %% ===================================================================
  15. %% Supervisor callbacks
  16. %% ===================================================================
  17. init([]) ->
  18. {ok, { {simple_one_for_one_terminate, 5, 10}, [?CHILD(erlv8_vm,transient,worker)]} }.