Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -module(oka_oprek_bgensrv).
- -behaviour(gen_server).
- %% API
- -export([stop/0, start_link/0, hello/0]).
- -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
- -record(state, {dummy}).
- start_link() ->
- gen_server:start_link({local, bgensrv}, ?MODULE, ["Oka Prinarjaya"], []).
- stop() ->
- gen_server:call(bgensrv, stop).
- hello() ->
- gen_server:call(bgensrv, hello).
- init(ApaAja) ->
- {ok, #state{dummy=ApaAja}}.
- handle_call(stop, _From, State) ->
- {stop, normal, State};
- handle_call(hello, From, State) ->
- {reply, {ok, 'hello_from_b', From}, State}.
- handle_cast(_Msg, State) ->
- {noreply, State}.
- handle_info(_Info, State) ->
- {noreply, State}.
- terminate(_Reason, _State) ->
- ok.
- code_change(_OldVsn, State, _Extra) ->
- {ok, State}.
Advertisement
Add Comment
Please, Sign In to add comment