Adding Linux ASYNC I/O to libev

Marc Lehmann schmorp at
Wed Mar 9 23:05:03 CET 2011

On Wed, Mar 09, 2011 at 01:04:55PM +0300, Konstantin Osipov <kostja.osipov at> wrote:
> Sorry if it was raised before, but are there plans to 
> add support for Linux asynchronous file I/O to libev loop?

Does linux (the kernel) have asynchronous file I/O nowadays - do you have
any pointers to "linux async file I/O"?

Last I looked, all aio functionality was still in userspace (glibc), with
much more overhead than libeio (and there is experimental and broken
kernel support that requires special (non-posix) fd's to work and has lots
of other limitations).

And then there is the problem of it often being slower than using threads.

> While it's not done, what's the canonical way to integrate libeio
> into libev loop?

the simplest "canonical" way is to send to an ev_async watcher from the
want_poll callback, then in the async watcher callback, call eio_poll
until it returns 0. for the done_cb argument you can pass 0, as the async
watcher does the necessary logic for you (it's possible to optimise a bit
more out of this).

I think so, at least... long time ago.

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

More information about the libev mailing list