aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/nif_SUITE.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2019-02-20 16:04:58 +0100
committerSverker Eriksson <[email protected]>2019-02-20 16:04:58 +0100
commit9197f6ea9af095eebbbf42e4ceca5ef762467276 (patch)
tree56e088a1c6e3ddeea421525e8eb4d0db044535e8 /erts/emulator/test/nif_SUITE.erl
parent1468c77c81de0f7c44e44d8c4a430ff0ee809736 (diff)
downloadotp-9197f6ea9af095eebbbf42e4ceca5ef762467276.tar.gz
otp-9197f6ea9af095eebbbf42e4ceca5ef762467276.tar.bz2
otp-9197f6ea9af095eebbbf42e4ceca5ef762467276.zip
erts: Add enif_set_pid_undefined & enif_is_pid_undefined
Diffstat (limited to 'erts/emulator/test/nif_SUITE.erl')
-rw-r--r--erts/emulator/test/nif_SUITE.erl28
1 files changed, 26 insertions, 2 deletions
diff --git a/erts/emulator/test/nif_SUITE.erl b/erts/emulator/test/nif_SUITE.erl
index 168df76301..c2d368bb72 100644
--- a/erts/emulator/test/nif_SUITE.erl
+++ b/erts/emulator/test/nif_SUITE.erl
@@ -64,7 +64,8 @@
nif_phash2/1,
nif_whereis/1, nif_whereis_parallel/1,
nif_whereis_threaded/1, nif_whereis_proxy/1,
- nif_ioq/1
+ nif_ioq/1,
+ pid/1
]).
-export([many_args_100/100]).
@@ -103,7 +104,8 @@ all() ->
nif_internal_hash_salted,
nif_phash2,
nif_whereis, nif_whereis_parallel, nif_whereis_threaded,
- nif_ioq].
+ nif_ioq,
+ pid].
groups() ->
[{G, [], api_repeaters()} || G <- api_groups()]
@@ -3367,6 +3369,23 @@ make_unaligned_binary(Bin0) ->
<<0:3,Bin:Size/binary,31:5>> = id(<<0:3,Bin0/binary,31:5>>),
Bin.
+pid(Config) ->
+ ensure_lib_loaded(Config),
+ Self = self(),
+ {true, ErlNifPid} = get_local_pid_nif(Self),
+ false = is_pid_undefined_nif(ErlNifPid),
+ Self = make_pid_nif(ErlNifPid),
+
+ UndefPid = set_pid_undefined_nif(),
+ true = is_pid_undefined_nif(UndefPid),
+ undefined = make_pid_nif(UndefPid),
+ 0 = send_term(UndefPid, message),
+
+ {false, _} = get_local_pid_nif(undefined),
+ ok.
+
+
+
id(I) -> I.
%% The NIFs:
@@ -3475,5 +3494,10 @@ convert_time_unit(_,_,_) -> ?nif_stub.
now_time() -> ?nif_stub.
cpu_time() -> ?nif_stub.
+get_local_pid_nif(_) -> ?nif_stub.
+make_pid_nif(_) -> ?nif_stub.
+set_pid_undefined_nif() -> ?nif_stub.
+is_pid_undefined_nif(_) -> ?nif_stub.
+
nif_stub_error(Line) ->
exit({nif_not_loaded,module,?MODULE,line,Line}).