Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % version 1
- -module(code_change_test).
- -behaviour(gen_server).
- -export([start/0, stop/0]).
- -export([state/0]).
- -export([
- init/1,
- handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3
- ]).
- start() -> gen_server:start({local, ?MODULE}, ?MODULE, [], []).
- stop() -> gen_server:cast(?MODULE, stop).
- state() -> gen_server:call(?MODULE, state).
- init(_Args) ->
- {ok, ver1}.
- handle_call(state, _From, State) ->
- io:fwrite("State=~p~n", [State]),
- {reply, State, State};
- handle_call(_Message, _From, State) ->
- {reply, ok, State}.
- handle_cast(stop, State) ->
- {stop, normal, State};
- handle_cast(_Message, State) ->
- {noreply, State}.
- handle_info(_Info, State) -> {noreply, State}.
- terminate(normal, _State) -> ok;
- terminate(_, _) -> ok.
- code_change(_OldVsn, State, _Extra) ->
- {ok, State}.
Add Comment
Please, Sign In to add comment