本文主要是介绍关于erlang:halt的更新说明,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
摘自:http://www.erlang.org/download/otp_src_R15B01.readme
OTP-9985 == erts stdlib ==
When an escript ends now all printout to standard output and
standard error gets out on the terminal. This bug has been
corrected by changing the behaviour of erlang:halt/0,1, which
should fix the same problem for other escript-like
applications, i.e that data stored in the output port driver
buffers got lost when printing on a TTY and exiting through
erlang:halt/0,1.
The BIF:s erlang:halt/0,1 has gotten improved semantics and
there is a new BIF erlang:halt/2 to accomplish something like
the old semantics. See the documentation.
Now erlang:halt/0 and erlang:halt/1 with an integer argument
will close all ports and allow all pending async threads
operations to finish before exiting the emulator. Previously
erlang:halt/0 and erlang:halt(0) would just wait for pending
async threads operations but not close ports. And
erlang:halt/1 with a non-zero integer argument would not even
wait for pending async threads operations.
To roughly the old behaviour, to not wait for ports and async
threads operations when you exit the emulator, you use
erlang:halt/2 with an integer first argument and an option
list containing {flush,false} as the second argument. Note
that now is flushing not dependant of the exit code, and you
can not only flush async threads operations which we deemed
as a strange behaviour anyway.
Also, erlang:halt/1,2 has gotten a new feature: If the first
argument is the atom 'abort' the emulator is aborted
producing a core dump, if the operating system so allows.
这篇关于关于erlang:halt的更新说明的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!