From 031773afa784bcee7419e625afa39e94f947bfa8 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Mon, 19 Mar 2012 15:42:41 +0100 Subject: erts: Document erlang:halt/2 and update erlang:halt/0,1 --- erts/doc/src/erlang.xml | 66 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 13 deletions(-) (limited to 'erts/doc/src/erlang.xml') diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml index fbe7b36163..3f7ac6ac19 100644 --- a/erts/doc/src/erlang.xml +++ b/erts/doc/src/erlang.xml @@ -1432,29 +1432,69 @@ true halt() Halt the Erlang runtime system and indicate normal exit to the calling environment -

Halts the Erlang runtime system and indicates normal exit to - the calling environment. Has no return value.

+

The same as + halt(0, []).

 > halt().
-os_prompt%
+os_prompt%
halt(Status) Halt the Erlang runtime system - Status = integer() >= 0 | string() + Status = integer() >= 0 | string() | abort -

Status must be a non-negative integer, or a string. - Halts the Erlang runtime system. Has no return value. - If Status is an integer, it is returned as an exit - status of Erlang to the calling environment. - If Status is a string, produces an Erlang crash dump - with String as slogan, and then exits with a non-zero - status code.

-

Note that on many platforms, only the status codes 0-255 are - supported by the operating system.

+

The same as + halt(Status, []).

+
+> halt(17).
+os_prompt% echo $?
+17
+os_prompt% 
+
+
+ + halt(Status, Options) + Halt the Erlang runtime system + + Status = integer() >= 0 | string() | abort + Options = [Option] + Option = {flush,boolean()} | term() + + +

Status must be a non-negative integer, a string, + or the atom abort. + Halts the Erlang runtime system. Has no return value. + Depending on Status: +

+ + integer() + The runtime system exits with the integer value Status + as status code to the calling environment (operating system). + + string() + An erlang crash dump is produced with Status as slogan, + and then the runtime system exits with status code 1. + + abort + + The runtime system aborts producing a core dump, if that is + enabled in the operating system. + + +

Note that on many platforms, only the status codes 0-255 are + supported by the operating system. +

+

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 + Option as {flush,false}. +

+

For statuses string() and abort the flush + option is ignored and flushing is not done. +

-- cgit v1.2.3