From d85e74e0c0e4bc66c875e2fd5f54d89255df0047 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Thu, 9 Feb 2017 15:23:11 +0100 Subject: erts: Add pid argument to enif_select --- erts/doc/src/erl_nif.xml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'erts/doc') diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index bd72bdb691..9800a530f2 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -2584,8 +2584,8 @@ enif_map_iterator_destroy(env, &iter); enum ErlNifSelectReturn - enif_select(ErlNifEnv* env, ErlNifEvent event, - enum ErlNifSelectFlags mode, void* obj, Eterm ref) + enif_select(ErlNifEnv* env, ErlNifEvent event, enum ErlNifSelectFlags mode, + void* obj, const ErlNifPid* pid, ERL_NIF_TERM ref) Manage subscription on IO event. @@ -2599,11 +2599,12 @@ enif_map_iterator_destroy(env, &iter); ERL_NIF_SELECT_READ, ERL_NIF_SELECT_WRITE or a bitwise OR combination to wait for both. It can also be ERL_NIF_SELECT_STOP which is described further below. When a read or write event is triggerred, - a notification message like this is sent to the Erlang process that called - enif_select:

+ a notification message like this is sent to the process identified by + pid:

{select, Obj, Ref, ready_input | ready_output}

ready_input or ready_output indicates if the event object is ready for reading or writing.

+

Argument pid may be NULL to indicate the calling process.

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 @@ -2616,7 +2617,8 @@ enif_map_iterator_destroy(env, &iter); then a reference created just before the receive will exploit a runtime optimization that bypasses all earlier received messages in the queue.

The notifications are one-shot only. To receive further notifications of the same - type (read or write), repeated calls to enif_select must be made.

+ type (read or write), repeated calls to enif_select must be made + after receiving each notification.

Use ERL_NIF_SELECT_STOP as mode in order to safely close an event object that has been passed to enif_select. The stop callback -- cgit v1.2.3