[erlang-questions] end of process

Lukas Larsson <>
Thu Nov 18 17:00:52 CET 2010


use exit/1 if the you want to manually terminate the process abnormally,
just let the code finish with ok or whatever if you want to terminate it
normally. 

See http://www.erlang.org/doc/reference_manual/processes.html#id78133
for more details.

Lukas

On Thu, 2010-11-18 at 16:46 +0100, info wrote:
> Hello,
> Could you refresh my mind ...
> In an gen_server I have this:
> 
> init() ->
> ...
> spawn_link(processA),
> ...
> 
> processA()->
> ...
> exit({error,processA_failed})
> ...
> 
> exit will kill the processA: correct ?
> who receives the error message ?
> 
> In this example (erlang doc) what happens if 
> 
> loop(Socket)->
> receive
> {tcp,Socket,Data}->process(Data),loop(Socket);
> {tcp_close,Socket}->ok
> end.
> 
> ok terminates the loop process: correct ?
> 
> Then what is the difference with my first example ? what is better: ok or exit or anything else ?
> 
> J-Ph. Constantin
> ITS3 Genve
> www.its3.ch



More information about the erlang-questions mailing list