Async Programming with poll/AIO

Async Programming with poll/AIO

Post by marcpo » Tue, 06 Aug 2002 07:19:59



HI,

I'm trying to build a (many connections serviced by each thread) server on
Solaris 2.6.  I check for incoming connections and internal queued workitems
(with the help of a pipe) using poll, however, I'd also like to be able to
use POSIX.4 asynchronous IO in the program.  This introduces an annoying
sticking point for me -- I can't think of a good way to trigger asynchronous
completion checking via poll (or any other good way to rephrase the
problem).

What I'm doing now is simply filling one end of a pipe when there's any
async IO pending so that the poll will always get awakened and call a
non-blocking aio_suspend to check on the status of my outstanding work ...
but as you can imagine, that leads to a lot of churn for no reason...

The only real way to do this I can think of is to throw away AIO and poll
for RDNORM/WRNORM on the set of previously AIO fds, but I'm loathe to
reinvent the wheel, figuring that AIO does a better job of this...

Does anyone have any suggestions?

 
 
 

Async Programming with poll/AIO

Post by marcpo » Tue, 06 Aug 2002 07:19:59


HI,

I'm trying to build a (many connections serviced by each thread) server on
Solaris 2.6.  I check for incoming connections and internal queued workitems
(with the help of a pipe) using poll, however, I'd also like to be able to
use POSIX.4 asynchronous IO in the program.  This introduces an annoying
sticking point for me -- I can't think of a good way to trigger asynchronous
completion checking via poll (or any other good way to rephrase the
problem).

What I'm doing now is simply filling one end of a pipe when there's any
async IO pending so that the poll will always get awakened and call a
non-blocking aio_suspend to check on the status of my outstanding work ...
but as you can imagine, that leads to a lot of churn for no reason...

The only real way to do this I can think of is to throw away AIO and poll
for RDNORM/WRNORM on the set of previously AIO fds, but I'm loathe to
reinvent the wheel, figuring that AIO does a better job of this...

Does anyone have any suggestions?