driver_control and blocking process

Bjorn Gustavsson <>
Tue Aug 23 12:05:51 CEST 2005


Since you didn't mention the platform, I (wrongly) assumed Unix.

On Windows, there is no need to use the pipe trick. Anything
that WaitForObject() or WaitForMultipleObject() accept can be passed
to driver_select(). If the library doesn't already give you a waitable
object, you could use an Event object.

/Bjorn

Eric Merritt <> writes:

> It's not blocking on a file descriptor, its a lib generating
> application specific events. There is an alternate api that allows for
> polling events. However, I would much rather simply wait for events to
> be generated rather then polling for them. I think the best way to
> solve this would be to do a pipe based driver, but pipe performance on
> windows is so dismal that I don't think its really an option.
> 
> On 23 Aug 2005 08:59:55 +0200, Bjorn Gustavsson <> wrote:
> > It will block the VM.
> > 
> > You must use driver_select() to arrange for your driver to
> > be called when somemthing happens with a file descriptor.
> > (If you don't have a file descriptor, the standard trick is
> > to create a pipe and pass the read end to driver to driver_select().)
> > 
> > /Bjorn
> > 
> > Eric Merritt <> writes:
> > 
> > > Guys,
> > >
> > >   I am working up a linked in driver using control that may block
> > > waiting for external events. Control seemed to be the easiest to
> > > implement by far. However, I h ave a worry that this will block the vm
> > > as a whole. I thought it might be a good idea to ask the experts.
> > >
> > > Thanks,
> > >   Eric
> > >
> > 
> > --
> > Björn Gustavsson, Erlang/OTP, Ericsson AB
> >
> 

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list