[erlang-questions] erl_driver and select() usage

Peer Stritzinger peerst@REDACTED
Thu Jul 4 16:45:45 CEST 2013

On 2013-06-24 09:30:47 +0000, Alessandro Sivieri said:

> Well, the asynchronous function of the library that I want to use 
> actually uses select() in its implementation... so in a way it is 
> already doing what I usually do with driver_select().

The driver_select() descriptor is necessary to notify the VM of async 
events.  Simplified the VM uses the filedescriptor in a big select or 
poll call together with all other drivers its waiting on.

If you can't use your library without doing its internal select() you 
need to run it in a separate thread like Max said and create a pipe to 
get a filedescriptor being passed in driver_select.

You then can write a byte to the other end of the pipe from your 
asyncrously running library to signal that you want your 
ready_{input,output} callback called to process the event.

AFAIK there is no other way to signal events to the VM from an 
separately running thread. 

-- Peer

> On Mon, Jun 24, 2013 at 5:43 AM, Max Lapshin <max.lapshin@REDACTED> wrote:
> It is good if you can find some file descriptor that is responsible for 
> your hardware events.
> If no then launch it in separate thread
> -- 
> Sivieri Alessandro
> alessandro.sivieri@REDACTED
> http://sivieri.wordpress.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130704/5da9828f/attachment.htm>

More information about the erlang-questions mailing list