Boost logo

Boost :

From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2005-09-06 05:53:47


Hi boosters,

I've implemented asynchronous file IO for linux in asio using aio_* functions.
I created a class called basic_stream_file (and a typedef called
stream_file) with almost the same interface as basic_stream_socket.
But with read/write and async_read/async_write functions and an
aio_demuxer_service. I writed it for the 0.3.2 version.

For now to be able to use this new demuxer, is needed to create a
demuxer of type:
asio::basic_demuxer<asio::detail::aio_demuxer_service>.

The implementation is attached.
I didnt had time to test it very much, but it seems to be working
okay. There are some problems that are related to aio_* in linux,
since it isnt completely implemented in today's kernels and isnt
implemented at all in 2.4.* kernels(there are patches however). And
the aio_* functions only work really asynchronous for now if used with
O_DIRECT and aligned buffers. But at least it could have a single
interface for AIO with files in Windows and Linux.
I'm planning to write asynchronous file I/O for windows with io
completions ports too. IMO it would be interesting to be able to have
a single demuxer in windows for file and socket AIO.

I'm sending attached a file that uses these classes as an example. It
must be linked with -laio and -lpthread and libaio must be installed.
(It wasnt in my slackware 10.1, dont know about the default setup of
other distributions).

Any feedback will be appreciated.
Thanks,
Felipe.

-- 
   Felipe Magno de Almeida
Developer from synergy and Computer Science student from State
University of Campinas(UNICAMP).
Unicamp: http://www.ic.unicamp.br
Synergy: http://www.synergy.com.br
"There is no dark side of the moon really. Matter of fact it's all dark."





Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk