From 9197f6ea9af095eebbbf42e4ceca5ef762467276 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 20 Feb 2019 16:04:58 +0100 Subject: erts: Add enif_set_pid_undefined & enif_is_pid_undefined --- erts/doc/src/erl_nif.xml | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'erts/doc/src') diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index d58ebd3171..ac873d0c8c 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -783,14 +783,16 @@ typedef struct {

A process identifier (pid). In contrast to pid terms (instances of ERL_NIF_TERM), ErlNifPids are self-contained and not bound to any environment. - ErlNifPid is an opaque type.

+ ErlNifPid is an opaque type. It can be copied, moved + in memory, forgotten, and so on.

ErlNifPort

A port identifier. In contrast to port ID terms (instances of ERL_NIF_TERM), ErlNifPorts are self-contained and not bound to any environment. - ErlNifPort is an opaque type.

+ ErlNifPort is an opaque type. It can be copied, moved + in memory, forgotten, and so on.

ErlNifResourceType @@ -1392,6 +1394,9 @@ enif_free_iovec(iovec);]]> initializes the pid variable *pid from it and returns true. Otherwise returns false. No check is done to see if the process is alive.

+

enif_get_local_pid will return false if argument + term is the atom + undefined.

@@ -1870,6 +1875,17 @@ enif_inspect_iovec(env, max_elements, term, &tail, &iovec); + + int + enif_is_pid_undefined(const ErlNifPid* pid) + Determine if pid is undefined. + +

Returns true if pid has been set as undefined by + enif_set_pid_undefined + .

+
+
+ int enif_is_port(ErlNifEnv* env, ERL_NIF_TERM term) @@ -2259,7 +2275,8 @@ enif_inspect_iovec(env, max_elements, term, &tail, &iovec); Make a pid term. -

Makes a pid term from *pid.

+

Makes a pid term or the atom + undefined from *pid.

@@ -2625,7 +2642,9 @@ enif_map_iterator_destroy(env, &iter);

Argument caller_env is the environment of the calling process or callback. Must only be NULL if calling from a custom thread.

Returns 0 on success, < 0 if no down callback is - provided, and > 0 if the process is no longer alive.

+ provided, and > 0 if the process is no longer alive or if + target_pid is + undefined.

This function is only thread-safe when the emulator with SMP support is used. It can only be used in a non-SMP emulator from a NIF-calling thread.

@@ -3080,7 +3099,9 @@ enif_map_iterator_destroy(env, &iter); enif_select_write introduced in erts-11.0 (OTP-22.0).

-

Argument pid may be NULL to indicate the calling process.

+

Argument pid may be NULL to indicate the calling + process. It must not be set as + undefined.

Argument obj is a resource object obtained from enif_alloc_resource. The purpose of the resource objects is as a container of the event object @@ -3270,6 +3291,17 @@ if (retval & ERL_NIF_SELECT_STOP_CALLED) { + + void + enif_set_pid_undefined(ErlNifPid* pid) + Set pid as undefined. + +

Sets an ErlNifPid + variable as undefined. See + enif_is_pid_undefined.

+ + + unsigned enif_sizeof_resource(void* obj) -- cgit v1.2.3 From 1937c8e3f7860ff3dfbeb6d25dd434fcd3102ba8 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 20 Feb 2019 16:06:03 +0100 Subject: erts: Add enif_compare_pids as a macro wrappper around enif_compare --- erts/doc/src/erl_nif.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'erts/doc/src') diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index ac873d0c8c..919f9f3245 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -1089,6 +1089,19 @@ typedef struct { + + int + enif_compare_pids(const ErlNifPid *pid1, const ErlNifPid *pid2) + Compare two pids. + +

Compares two ErlNifPid + s according to term order.

+

Returns 0 if pid1 and pid2 are equal, + < 0 if pid1 < pid2, and + > 0 if pid1 > pid2.

+
+
+ void enif_cond_broadcast(ErlNifCond *cnd) -- cgit v1.2.3 From edcec4c9166bfdfbd3131ee1472abcade8ccac15 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Thu, 21 Feb 2019 14:51:34 +0100 Subject: fixup! erts: Add enif_compare_pids fix broken html link --- erts/doc/src/erl_nif.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'erts/doc/src') diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index 919f9f3245..cc7452bab5 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -1090,8 +1090,9 @@ typedef struct { - int - enif_compare_pids(const ErlNifPid *pid1, const ErlNifPid *pid2) + int + enif_compare_pids(const ErlNifPid *pid1, const ErlNifPid *pid2) + Compare two pids.

Compares two ErlNifPid -- cgit v1.2.3