Sha256: 84bd140f428827b2b9d2c3e367f1436e28e709933a3873387c9d43199b64d198

Contents?: true

Size: 949 Bytes

Versions: 14

Compression:

Stored size: 949 Bytes

Contents

-module(cap_event_sup).
-behaviour(gen_server).

-include("capricorn.hrl").

-export([start_link/3,start_link/4, stop/1]).
-export([init/1, terminate/2, handle_call/3, handle_cast/2, handle_info/2,code_change/3]).

start_link(EventMgr, EventHandler, Args) ->
  gen_server:start_link(cap_event_sup, {EventMgr, EventHandler, Args}, []).

start_link(ServerName, EventMgr, EventHandler, Args) ->
  gen_server:start_link(ServerName, cap_event_sup, {EventMgr, EventHandler, Args}, []).

stop(Pid) ->
  gen_server:cast(Pid, stop).

init({EventMgr, EventHandler, Args}) ->
  ok = gen_event:add_sup_handler(EventMgr, EventHandler, Args),
  {ok, {EventMgr, EventHandler}}.

terminate(_Reason, _State) ->
  ok.

handle_call(_Whatever, _From, State) ->
  {ok, State}.

handle_cast(stop, State) ->
  {stop, normal, State}.

handle_info({gen_event_EXIT, _Handler, Reason}, State) ->
  {stop, Reason, State}.

code_change(_OldVsn, State, _Extra) ->
  {ok, State}.

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
capricorn-2.0.11 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.10 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.9 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.8 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.7 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.6 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.5 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.4 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.3 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.3.pre2 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.3.pre erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.2 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.1 erlang/lib/capricorn/src/cap_event_sup.erl
capricorn-2.0.0 erlang/lib/capricorn/src/cap_event_sup.erl