Logo

Programming-Idioms

History of Idiom 87 > diff from v6 to v7

Edit summary for version 7 by :

Version 6

2015-10-22, 00:55:25

Version 7

2015-10-22, 00:56:14

Idiom #87 Stop program

Exit immediatly.
If some extra cleanup work is executed by the program runtime (not by the OS itself), describe it.

Idiom #87 Stop program

Exit immediatly.
If some extra cleanup work is executed by the program runtime (not by the OS itself), describe it.

Code
erlang:halt(0).
Code
erlang:halt(0).
Comments bubble
0_ means normal termination. Any other integer will result in that value being the exit status of the program.
A string will crash the vm and generate a crash report with that as the slogan.
The atom abort will cause the runtime system to abort, if that's allowed

For integer Status the Erlang runtime system closes all ports and allows async threads to finish their operations before exiting. To exit without such flushing use you can use erlang:halt(Status, [{flush, false}]).
Comments bubble
0_ means normal termination. Any other integer will result in that value being the exit status of the program.
A string will crash the vm and generate a crash report with that as the slogan.
The atom abort will cause the runtime system to abort, if that's allowed

For integer Status the Erlang runtime system closes all ports and allows async threads to finish their operations before exiting. To exit without such flushing use you can use
erlang:halt( Status, [{flush, false}]).
Doc URL
http://erldocs.com/current/erts/erlang.html?i=0&search=halt#halt/0
Doc URL
http://erldocs.com/current/erts/erlang.html?i=0&search=halt#halt/0
Demo URL
http://tryerl.seriyps.ru/#id=23f3
Demo URL
http://tryerl.seriyps.ru/#id=23f3