The Generic Server Template

gen_server_template.full
 
%%%-------------------------------------------------------------------
 
%%% @author some name <me@hostname.local>
 
%%% @copyright (C) 2013, some name
 
%%% @doc
 
%%%
 
%%% @end
 
%%% Created : 26 May 2013 by some name <me@hostname.local>
 
%%%-------------------------------------------------------------------
 
-module​().
 
 
-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).
 
 
-record​(state, {}).
 
 
%%%===================================================================
 
%%% API
 
%%%=================================================================== ...

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.