State of IOCP work

Marc Lehmann schmorp at
Mon Nov 29 09:10:06 CET 2010

On Mon, Nov 29, 2010 at 02:01:29PM +1100, Mark Hammond <mhammond at> wrote:
> * What is that state of the code wrapped around EV_USE_IOCP?  Is it
> abandonded, experimental, progressing slowly etc?

It's vestigates of an old experiment to see if it could be done in a
different way.

It can't, and in fact, it can't be done at all, even using tricky
workarounds, mostly because windows doesn't generate enough events and
that you need a special type of socket that doesn't work non-blocked,
which makes it rather useless.

The best thing you could do is use socket events (not iocps) and request
feedback support from the application for writes. But that requires one
thread per every 63 sockets and suffers from other limits.

I do wish windows had something like epoll or kqueue and not these
horrible half-done hacks that all don't work together, but it's not my
call :/

> educational purposes?  It would be nice to see the direction it is
> taking so informed decisions can be made about how node.js might
> support async IO on Windows (and might even lead to contributions on
> this effort ;)

async I/O is not something libev does or ever planned to, nor does it make
any sense with libev or with sockets in general, as libev doesn't do any
I/O for you. the experiment existed solely to see if libev could use iocp
as a backend, but iocps are not featureful enough to support I/O events,
so can't be done.

If you want to do async I/O, you need to look at libeio, which does it for
you on posix (also on windows as long as you compile it under some posix
env), or do it yourself, for example using iocp's. a for sockets, async
I/O is a bad way to do it, there are variants that might get you some
events, but windows itself simply doesn't offer the richness of posix, so
libev will never be able to use it as backend until windows gets rid of
the many limitations around it.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list