gen_server documentation

Samuel Rivas samuel@REDACTED
Fri Apr 7 12:42:00 CEST 2006

Matthias Lang wrote:
> The documentation is correct.
> You have overlooked how linked processes must behave. If you link a
> process and then exit, then your process (the shell, in your example)
> will exit too.
> If you don't want that to happen, you can either not link in the first
> place, or you can trap exits. Example:
> 3> process_flag(trap_exit, true).
> false
> 4> gen_server:start_link(dumb_server, [], []).
> {error,foo}
> Matthias

Mmm yes. I was somehow deceived into believing that gen_server was supposed
to catch init exits and return {error, Reason}.

Obviously, you can't catch an spawn_link. My fault.

PS: I didn't say the documentation was wrong. I said that those
functions behave differently, so I was right (just by chance) :)

More information about the erlang-questions mailing list