Gen processes and exit/2 from shell

Luke Gorrie luke@REDACTED
Tue Dec 17 11:19:52 CET 2002


Vladimir Sekissov <svg@REDACTED> writes:

> Good day,
> 
> Could somebody explain me why gen_* processes don't trap
> 
> exit(GenProcessPid, Reson)
> 
> if it executed from erlang shell when ordinary processes do?

It is a special case in gen_server:loop/6 that if your parent process
(the one that spawned you) dies then you have to terminate, even if
you're trapping exits. I guess the intention is to use a reliable
parent like a supervisor, and not outlive it.

When you use exit/2 from the shell it will get an {'EXIT', ShellPid,
Rsn} signal - so if ShellPid == Parent (who spawned the server) then
you would hit the special case.

-Luke




More information about the erlang-questions mailing list