Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (26 sloc) 715 Bytes
-module(link_ex).
-behaviour(gen_server).
-export([start_link/0, ping/0]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
-define(SERVER, ?MODULE).
-record(state, {}).
start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
ping() ->
gen_server:cast(?SERVER, ping).
init([]) ->
{ok, #state{}}.
handle_call(_Request, _From, State) ->
Reply = ok,
{reply, Reply, State}.
handle_cast(ping, State) ->
io:format("Got It!~n"),
{noreply, State}.
handle_info(timeout, State) ->
{noreply, State}.
terminate(_Reason, _State) ->
ok.
code_change(_OldVsn, State, _Extra) ->
{ok, State}.