[erlang-questions] clarify: gen_server:start_link/3 return values?
Bengt Kleberg
bengt.kleberg@REDACTED
Thu Apr 25 10:19:12 CEST 2013
What about the documentation for gen_server:start_link/3 that says:
"If Module:init/1 returns {stop,Reason} or ignore, the process is
terminated and the function returns {error,Reason} or ignore,
respectively."
Not a native English speaker I might be seeing things that are not there
but does that not promise a return value?
Also, "fail with Reason" usually means crashes/exits. However, even if
init/1 crashes/exists I do not get a return value from
gen_server:start_link/3.
Under what circumstances will gen_server:start_link/3 return {error,
Reason}?
bengt
On Thu, 2013-04-25 at 11:03 +0300, Aggelos Giantsios wrote:
>
> On Thu, Apr 25, 2013 at 10:53 AM, Bengt Kleberg
> <bengt.kleberg@REDACTED> wrote:
> Greetings,
>
> Should gen_server:start_link/3 return {error, Reason} if my
> init/1
> returns {stop, Reason}?
>
> Hey there!
>
> gen_server:start_link/3 should return {error, Reason} only if init/1
> fails with Reason.
> In the case where init/1 returns {error, Reason} or ignore, the
> process that calls gen_server:start_link/3 should fail with Reason or
> ignore respectively.
>
> Aggelos
More information about the erlang-questions
mailing list