Guest User

Untitled

a guest
May 27th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. -module(special_process).
  2.  
  3. -export([start_link/0,
  4. init/1,
  5. loop/1,
  6. system_continue/3,
  7. system_terminate/4,
  8. system_code_change/4]).
  9.  
  10. %% Remember to use fully qualified function calls, where you want code loading to happen.
  11.  
  12. start_link() -> proc_lib:start_link(?MODULE , init, [self()]).
  13.  
  14. init(Parent) ->
  15. register(?MODULE, self()),
  16. proc_lib:init_ack({ok, self()}),
  17. loop(state).
  18.  
  19. loop(state) ->
  20. receive
  21. {'EXIT', Parent, Reason} ->
  22. exit(Reason);
  23. {system, From, Request} ->
  24. sys:handle_system_msg(Request, From, Parent, ?MODULE, [], {state}).
  25. end.
  26.  
  27. system_continue(_Parent, _Debug, {state}) -> loop(state).
  28.  
  29. system_terminate(Reason, _Parent, _Debug, _State) -> exit(Reason).
  30.  
  31. system_code_change(State, _Module, _OldVsn, _Extra) -> {ok, State}.
Add Comment
Please, Sign In to add comment