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

Daniel Goertzen daniel.goertzen@REDACTED
Wed Dec 7 21:41:40 CET 2016


The presence of the resource makes sense.  But why the special close/stop
methods?  Is the existing destructor insufficient in some way?


On Wed, Dec 7, 2016 at 12:38 PM Sverker Eriksson <
sverker.eriksson@REDACTED> wrote:

>
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161207/92e82ee2/attachment.htm>


More information about the erlang-questions mailing list