[erlang-questions] [Q]: Terminating supervisor and its workers

Samuel Rivas samuelrivas@REDACTED
Thu Jul 26 09:10:00 CEST 2007


Ladislav Lenart wrote:
> Lennart Öhman wrote:
> > have you turned trap_exit to true in your worker?
> 
> No, I haven't. And frankly I don't want to. I am using
> a standard piece of library functionality so why I have
> to tweak my callback module to make it work? (I was
> hoping that gen_server:start and gen_server:start_link
> will make the difference.)
> 
> But if this is the Erlang way, I will do it.

  If you do not trap exits, the process will die at the moment it receives the
'EXIT' signal. The OTP-way is putting a process_flag(trap_exit, true) in the
gen_server's init function and write your cleanup code in the gen_server's
terminate/2 function.

Regards
-- 
	Samuel



More information about the erlang-questions mailing list