[erlang-questions] clarify: gen_server:start_link/3 return values?

Bengt Kleberg <>
Thu Apr 25 09:53:15 CEST 2013


Greetings,

Should gen_server:start_link/3 return {error, Reason} if my init/1
returns {stop, Reason}?

When I return {stop, Reason} from init/1, then gen_server:start/3
returns {error, Reason}.

I think the documentation promises the same for gen_server:start_link/3.
Is my understanding correct?

Test program:

-module(t).
-export([a/0, al/0, init/1]).

a() ->
	gen_server:start(t, [], []).
al() ->
	gen_server:start_link(t, [], []).


init([]) -> {stop, t}.


bengt




More information about the erlang-questions mailing list