Permalink
Browse files

Adding start_link/5 so a server process can register a name at startu…

…p like gen_server
  • Loading branch information...
1 parent 2251bfb commit 94ecf51a00e250a17b3eb55029d8b685a59090b9 @kevsmith committed Apr 15, 2010
Showing with 12 additions and 1 deletion.
  1. +12 −1 src/gen_nb_server.erl
View
@@ -25,7 +25,7 @@
-behaviour(gen_server).
%% API
--export([start_link/4]).
+-export([start_link/4, start_link/5]).
%% Behavior callbacks
-export([behaviour_info/1]).
@@ -63,6 +63,17 @@ behaviour_info(_) ->
start_link(CallbackModule, IpAddr, Port, InitParams) ->
gen_server:start_link(?MODULE, [CallbackModule, IpAddr, Port, InitParams], []).
+%% @spec start_link(CallbackModule, IpAddr, Port, InitParams) -> Result
+%% Name = {local, atom()} | atom()
+%% CallbackModule = atom()
+%% IpAddr = string()
+%% Port = integer()
+%% InitParams = [any()]
+%% Result = {ok, pid()} | {error, any()}
+%% @doc Start server listening on IpAddr:Port registered as Name
+start_link(Name, CallbackModule, IpAddr, Port, InitParams) ->
+ gen_server:start_link(Name, ?MODULE, [CallbackModule, IpAddr, Port, InitParams], []).
+
%% @hidden
init([CallbackModule, IpAddr, Port, InitParams]) ->
case CallbackModule:init(InitParams) of

0 comments on commit 94ecf51

Please sign in to comment.