[erlang-questions] Do you wanna play with enif_select?

Sverker Eriksson sverker.eriksson@REDACTED
Wed Dec 7 19:37:49 CET 2016



On 12/07/2016 06:43 PM, Daniel Goertzen wrote:
> I'm excited to see progress in the area, but I am struggling to understand
> a few things in the enif_select API:
>
> 1. Why are the resource extensions required? Couldn't a 'stop' message be
> sent to the calling process which could then call a plain old NIF to shut
> things down?

The idea was to also be able to handle cases when the process
is no longer alive. For example, if it crashes due to some error.
The stop function can then be called by the VM to do the cleanup
and avoid leaking file descriptors.


> 2. Does the ref parameter have to be a ref?  An arbitrary term would be
> useful.
The current implementation only works for local refs and
immediate terms (atoms, small integers, local pids and ports).
I thought I should keep it simple to begin with, but it would be
no problem to accept other terms. Just some more code to
handle the dynamic allocation as the terms need to be copied
from and to the process heap.


/Sverker




More information about the erlang-questions mailing list