diff options
author | Rickard Green <[email protected]> | 2018-03-23 14:12:52 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2018-03-23 14:12:52 +0100 |
commit | 5c2acbd35150da5e6d3afba1f61bb8bb995bb80f (patch) | |
tree | 9250351fba7a64b5b1f9ff11fff7da8563ec3155 /erts/preloaded/src | |
parent | be2bdf8c8c0bd3d110277fcbe8dc3611163087cc (diff) | |
parent | 83a289d4dff156f2c7203843a1437256545f5580 (diff) | |
download | otp-5c2acbd35150da5e6d3afba1f61bb8bb995bb80f.tar.gz otp-5c2acbd35150da5e6d3afba1f61bb8bb995bb80f.tar.bz2 otp-5c2acbd35150da5e6d3afba1f61bb8bb995bb80f.zip |
Merge branch 'rickard/signals/OTP-14589'
* rickard/signals/OTP-14589:
Fix VM probes compilation
Fix lock counting
Fix signal order for is_process_alive
Fix signal handling priority elevation
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r-- | erts/preloaded/src/erlang.erl | 28 | ||||
-rw-r--r-- | erts/preloaded/src/erts_internal.erl | 21 |
2 files changed, 21 insertions, 28 deletions
diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl index f8221868e2..bffa59338e 100644 --- a/erts/preloaded/src/erlang.erl +++ b/erts/preloaded/src/erlang.erl @@ -39,7 +39,6 @@ -export([integer_to_list/2]). -export([integer_to_binary/2]). -export([set_cpu_topology/1, format_cpu_topology/1]). --export([await_proc_exit/3]). -export([memory/0, memory/1]). -export([alloc_info/1, alloc_sizes/1]). @@ -3530,33 +3529,6 @@ rvrs(Xs) -> rvrs(Xs, []). rvrs([],Ys) -> Ys; rvrs([X|Xs],Ys) -> rvrs(Xs, [X|Ys]). -%% erlang:await_proc_exit/3 is for internal use only! -%% -%% BIFs that need to await a specific process exit before -%% returning traps to erlang:await_proc_exit/3. -%% -%% NOTE: This function is tightly coupled to -%% the implementation of the -%% erts_bif_prep_await_proc_exit_*() -%% functions in bif.c. Do not make -%% any changes to it without reading -%% the comment about them in bif.c! --spec erlang:await_proc_exit(dst(), 'apply' | 'data' | 'reason', term()) -> term(). -await_proc_exit(Proc, Op, Data) -> - Mon = erlang:monitor(process, Proc), - receive - {'DOWN', Mon, process, _Proc, Reason} -> - case Op of - apply -> - {M, F, A} = Data, - erlang:apply(M, F, A); - data -> - Data; - reason -> - Reason - end - end. - -spec min(Term1, Term2) -> Minimum when Term1 :: term(), Term2 :: term(), diff --git a/erts/preloaded/src/erts_internal.erl b/erts/preloaded/src/erts_internal.erl index fb709e7482..da5c9c68ed 100644 --- a/erts/preloaded/src/erts_internal.erl +++ b/erts/preloaded/src/erts_internal.erl @@ -78,6 +78,8 @@ %% Auto import name clash -export([check_process_code/1]). +-export([is_process_alive/1, is_process_alive/2]). + %% %% Await result of send to port %% @@ -600,3 +602,22 @@ group_leader(_GL, _Pid) -> group_leader(_GL, _Pid, _Ref) -> erlang:nif_error(undefined). + +-spec erts_internal:is_process_alive(Pid, Ref) -> 'ok' when + Pid :: pid(), + Ref :: reference(). + +is_process_alive(_Pid, _Ref) -> + erlang:nif_error(undefined). + +-spec erts_internal:is_process_alive(Pid) -> boolean() when + Pid :: pid(). + +is_process_alive(Pid) -> + Ref = make_ref(), + erts_internal:is_process_alive(Pid, Ref), + receive + {Ref, Res} -> + Res + end. + |