Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -module(special_process).
- -export([start_link/0,
- init/1,
- loop/1,
- system_continue/3,
- system_terminate/4,
- system_code_change/4]).
- %% Remember to use fully qualified function calls, where you want code loading to happen.
- start_link() -> proc_lib:start_link(?MODULE , init, [self()]).
- init(Parent) ->
- register(?MODULE, self()),
- proc_lib:init_ack({ok, self()}),
- loop(state).
- loop(state) ->
- receive
- {'EXIT', Parent, Reason} ->
- exit(Reason);
- {system, From, Request} ->
- sys:handle_system_msg(Request, From, Parent, ?MODULE, [], {state}).
- end.
- system_continue(_Parent, _Debug, {state}) -> loop(state).
- system_terminate(Reason, _Parent, _Debug, _State) -> exit(Reason).
- system_code_change(State, _Module, _OldVsn, _Extra) -> {ok, State}.
Add Comment
Please, Sign In to add comment