Skip to content

Instantly share code, notes, and snippets.

@sergium
Created September 8, 2015 09:15
Show Gist options
  • Select an option

  • Save sergium/e65a41d7e6956c436177 to your computer and use it in GitHub Desktop.

Select an option

Save sergium/e65a41d7e6956c436177 to your computer and use it in GitHub Desktop.

Revisions

  1. sergium created this gist Sep 8, 2015.
    43 changes: 43 additions & 0 deletions example.erl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
    %% ex: ts=4 sw=4 et
    %% @author Kevin Smith <[email protected]>
    %% @copyright 2011 Opscode, Inc.

    -module(example).

    -behaviour(gen_server).

    -export([start_link/0]).

    %% gen_server callbacks
    -export([init/1,
    handle_call/3,
    handle_cast/2,
    handle_info/2,
    terminate/2,
    code_change/3]).

    -record(state, {}).

    start_link() ->
    gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).

    init([]) ->
    {ok, #state{}}.

    handle_call(_Request, _From, State) ->
    {reply, ignored, State}.

    handle_cast(_Msg, State) ->
    {noreply, State}.

    handle_info(_Info, State) ->
    {noreply, State}.

    terminate(_Reason, _State) ->
    ok.

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

    %% Internal functions