Skip to content

Instantly share code, notes, and snippets.

@wmealing
Created May 27, 2013 15:02
Show Gist options
  • Save wmealing/5657526 to your computer and use it in GitHub Desktop.
Save wmealing/5657526 to your computer and use it in GitHub Desktop.
-module(ee_rule).
-include_lib("eunit/include/eunit.hrl").
-behaviour(gen_server).
%% API
-export([start_link/0]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
-define(SERVER, ?MODULE).
start_link(EName) ->
io:format("Starting EM ...~p~n", [EName]),
NameAtom = list_to_atom(EName),
gen_server:start_link({local, NameAtom}, ?MODULE, [NameAtom], []).
init([]) ->
Me = whereis(list_to_atom(MyName)),
add_match(Me,any),
{ok, #state{fired = false}}.
handle_call({add_match, _MatchType}, _From, State) ->
Reply = ok,
{reply, Reply, State}.
add_match(ServerPID, MatchType)->
gen_server:call(ServerPID, {add_match, MatchType}).
1>
=CRASH REPORT==== 28-May-2013::00:57:12 ===
crasher:
initial call: ee_rule:init/1
pid: <0.56.0>
registered_name: []
exception exit: {timeout,{gen_server,call,[<0.56.0>,{add_match,any}]}}
in function gen_server:init_it/6 (gen_server.erl, line 328)
ancestors: [rule_manager_sup,<0.54.0>]
messages: [{'$gen_call',{<0.56.0>,#Ref<0.0.0.146>},{add_match,any}}]
links: [<0.55.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 610
stack_size: 27
reductions: 426
neighbours:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment