AIO integration

Paul Colomiets pc at
Sat May 3 12:22:58 CEST 2008

(Marc, sorry for initial off-list reply)

Marc Lehmann wrote:
> On Thu, May 01, 2008 at 12:20:36AM +0300, Paul Colomiets <pc at> wrote:
>> I'm looking for integration of libev with
>> asynchronous io for files. It should be
>> integrated quite naturally, using
>> real-time signals for linux and other
>> posix compatible OSes, and probably
> real-time signals are neither natural nor imho a good way to do that
Yes, I think kqueue is better (if it works :) ). And actually target
platform is FreeBSD. (Althrought most development is done
on Linux).
> (the implementation complexity is enourmous),
Do you mean writing, reading and polling signal pipe?
(Or I'm should be aware of something else?)
> besides, linux doesn't have
> generic asynchronous I/O for files yet (and I don't really see plans to
> add it anytime soon, the same for solaris).
Do you mean there isn't anything besides read and write?

>> I think interface should look like:
>> ev::fileio io;
>> io.set(fd, ev::READ)
>> io.start(buf, buflen)
> You forgot the file offset.
Yup. It was too late when I've noticed :)
> I think a mature aio interface needs to cope at least with open and stat
> as well (and then probably the full host of POSIX functionality).
I feel than in my use case it is enough to have only read
and write asynchronous. But it would be great to design and
implement an API which will provide bigger (but fixed) set
of calls asynchronously, even if in the most simple
implementation they will be called at the end of loop
iteration. This way programs can be designed with
asynchronous calls in mind, and then configured to
use threaded or synchronous or whatever model
is appropriate with something like EV_USE_* flags.

I'll bring more concrete API design ideas later.


More information about the libev mailing list