diff options
author | Raimo Niskanen <[email protected]> | 2012-03-19 10:49:39 +0100 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2012-03-21 10:23:06 +0100 |
commit | 3a10d2e251e5490c05b32ca9c18165e9d1a055d9 (patch) | |
tree | 8dbe031c425fe80a950cd22f26d2a0e3d38fa22a /erts | |
parent | b9f091205a4871f248f17a733c569d5921b6d329 (diff) | |
download | otp-3a10d2e251e5490c05b32ca9c18165e9d1a055d9.tar.gz otp-3a10d2e251e5490c05b32ca9c18165e9d1a055d9.tar.bz2 otp-3a10d2e251e5490c05b32ca9c18165e9d1a055d9.zip |
erts: Make erlang:halt/0,1 close ports and flush async threads
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/beam/bif.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index f8305944a4..148817bc7c 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 1996-2011. All Rights Reserved. + * Copyright Ericsson AB 1996-2012. All Rights Reserved. * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in @@ -3666,9 +3666,8 @@ BIF_RETTYPE display_nl_0(BIF_ALIST_0) BIF_RETTYPE halt_0(BIF_ALIST_0) { VERBOSE(DEBUG_SYSTEM,("System halted by BIF halt/0\n")); - erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN); - erl_exit(0, ""); - return NIL; /* Pedantic (lint does not know about erl_exit) */ + erl_halt(0); + ERTS_BIF_YIELD1(bif_export[BIF_halt_1], BIF_P, am_undefined); } /**********************************************************************/ @@ -3685,12 +3684,12 @@ BIF_RETTYPE halt_1(BIF_ALIST_1) if (is_small(BIF_ARG_1) && (code = signed_val(BIF_ARG_1)) >= 0) { VERBOSE(DEBUG_SYSTEM,("System halted by BIF halt(%d)\n", code)); - erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN); - erl_exit(-code, ""); - } else if (is_string(BIF_ARG_1) || BIF_ARG_1 == NIL) { - if ((i = intlist_to_buf(BIF_ARG_1, msg, MSG_SIZE-1)) < 0) { + erl_halt((int)(- code)); + ERTS_BIF_YIELD1(bif_export[BIF_halt_1], BIF_P, am_undefined); + } + else if (is_string(BIF_ARG_1) || BIF_ARG_1 == NIL) { + if ((i = intlist_to_buf(BIF_ARG_1, halt_msg, HALT_MSG_SIZE-1)) < 0) goto error; - } msg[i] = '\0'; VERBOSE(DEBUG_SYSTEM,("System halted by BIF halt(%s)\n", msg)); erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN); |