Created
August 5, 2015 09:14
-
-
Save hukl/baa2511fa73212741bc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(). | |
-behavior(gen_server). | |
% Managment API | |
-export([start/0, start_link/0, stop/0]). | |
% gen_server callbacks | |
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, | |
code_change/3]). | |
% Public API | |
-export([]). | |
% Example state record | |
% -record(state, { data = {} }). | |
%% =================================================================== | |
%% Management API | |
%% =================================================================== | |
start() -> | |
gen_server:start({local, ?MODULE}, ?MODULE, [], []). | |
start_link() -> | |
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). | |
stop() -> gen_server:cast(?MODULE, stop). | |
%% =================================================================== | |
%% gen_server callbacks | |
%% =================================================================== | |
init([]) -> | |
{ok, {}}. | |
handle_call(_Msg, _From, State) -> | |
{reply, ok, State}. | |
handle_cast(stop, State) -> | |
{stop, normal, State}; | |
handle_cast(_Msg, State) -> | |
{stop, normal, State}. | |
code_change(_OldVsn, State, _Extra) -> | |
{ok, State}. | |
handle_info(_Info, State) -> | |
{noreply, State}. | |
terminate(_Reason, _State) -> | |
whatever. | |
%% =================================================================== | |
%% Public API | |
%% =================================================================== | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment