PageRenderTime 110ms CodeModel.GetById 27ms app.highlight 2ms RepoModel.GetById 42ms app.codeStats 0ms

/Max/server_util.erl

http://github.com/anonymous-admin/anonymous
Erlang | 20 lines | 17 code | 3 blank | 0 comment | 0 complexity | a461c8e34d8d3c8b6ebac643e4984652 MD5 | raw file
 1-module(server_util).
 2
 3-compile([export_all]).
 4
 5start(ServerName, {Module, Function, Args}) ->
 6		   case whereis(ServerName) of
 7		     undefined ->
 8		       Pid = spawn(Module, Function, Args),
 9		       register(ServerName, Pid);
10		     _ ->
11		       ok
12		   end.
13
14stop(ServerName) ->
15			 case whereis(ServerName) of
16			     undefined ->
17				 ok;
18			     _ ->
19				 ServerName!shutdown
20			 end.