aboutsummaryrefslogtreecommitdiffstats
path: root/erts/doc/src
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2019-01-07 16:29:09 +0100
committerSverker Eriksson <[email protected]>2019-01-07 16:29:09 +0100
commit61d53b3246ae4e5869f1b65cc2ac1b35b76de1da (patch)
tree48a2bd7ca624c6e416bd512d2b77d976fa3aa4fc /erts/doc/src
parent619514492966ba6b7c6e6fee807329c81c8bf7a8 (diff)
downloadotp-61d53b3246ae4e5869f1b65cc2ac1b35b76de1da.tar.gz
otp-61d53b3246ae4e5869f1b65cc2ac1b35b76de1da.tar.bz2
otp-61d53b3246ae4e5869f1b65cc2ac1b35b76de1da.zip
erts: Add enif_select_read|write with 'msg_env' argument
Diffstat (limited to 'erts/doc/src')
-rw-r--r--erts/doc/src/erl_nif.xml33
1 files changed, 33 insertions, 0 deletions
diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml
index 3fe6e00d57..34042cb4de 100644
--- a/erts/doc/src/erl_nif.xml
+++ b/erts/doc/src/erl_nif.xml
@@ -3063,6 +3063,11 @@ enif_map_iterator_destroy(env, &amp;iter);</code>
<code type="none">{select, Obj, Ref, ready_input | ready_output}</code>
<p><c>ready_input</c> or <c>ready_output</c> indicates if the event object
is ready for reading or writing.</p>
+ <note><p>For complete control over the message format use the newer functions
+ <seealso marker="#enif_select_read"><c>enif_select_read</c></seealso> or
+ <seealso marker="#enif_select_write"><c>enif_select_write</c></seealso>
+ introduced in erts-11.0 (OTP-22.0).</p>
+ </note>
<p>Argument <c>pid</c> may be <c>NULL</c> to indicate the calling process.</p>
<p>Argument <c>obj</c> is a resource object obtained from
<seealso marker="#enif_alloc_resource"><c>enif_alloc_resource</c></seealso>.
@@ -3157,6 +3162,34 @@ if (retval &amp; ERL_NIF_SELECT_STOP_CALLED) {
</func>
<func>
+ <name since="OTP 22.0"><ret>int</ret>
+ <nametext>enif_select_read(ErlNifEnv* env, ErlNifEvent event, void* obj,
+ const ErlNifPid* pid, ERL_NIF_TERM msg, ErlNifEnv* msg_env)</nametext>
+ </name>
+ <name since="OTP 22.0"><ret>int</ret>
+ <nametext>enif_select_write(ErlNifEnv* env, ErlNifEvent event, void* obj,
+ const ErlNifPid* pid, ERL_NIF_TERM msg, ErlNifEnv* msg_env)</nametext>
+ </name>
+ <fsummary>Manage subscription on IO event.</fsummary>
+ <desc>
+ <p>These are variants of <seealso marker="#enif_select">enif_select</seealso>
+ where you can supply your own message term <c>msg</c> that will be sent to
+ the process instead of the predefined tuple <c>{select,_,_,_}.</c></p>
+ <p>Argument <c>msg_env</c> must either be <c>NULL</c> or the environment of
+ <c>msg</c> allocated with <seealso marker="#enif_alloc_env">
+ <c>enif_alloc_env</c></seealso>. If argument <c>msg_env</c> is
+ <c>NULL</c> the term <c>msg</c> will be copied, otherwise both
+ <c>msg</c> and <c>msg_env</c> will be invalidated by a successful call
+ to <c>enif_select_read</c> or <c>enif_select_write</c>.</p>
+ <p>Apart from the message format <c>enif_select_read</c> and
+ <c>enif_select_write</c> behaves exactly the same as <seealso
+ marker="#enif_select">enif_select</seealso> with argument <c>mode</c> as
+ either <c>ERL_NIF_SELECT_READ</c> or <c>ERL_NIF_SELECT_WRITE</c>. To
+ cancel or close events use <seealso marker="#enif_select">enif_select</seealso>.</p>
+ </desc>
+ </func>
+
+ <func>
<name since="OTP R14B"><ret>ErlNifPid *</ret>
<nametext>enif_self(ErlNifEnv* caller_env, ErlNifPid* pid)</nametext>
</name>