Boost logo

Boost :

From: Felipe Magno de Almeida (felipe.m.almeida_at_[hidden])
Date: 2005-09-07 02:57:55


On 9/6/05, Christopher Kohlhoff <chris_at_[hidden]> wrote:
> Hi Felipe,
>

Hi,

>

[snip]

>
> Yeah, I can't really think of a good solution to the problem of
> correctly aligning the buffers. We may have to provide some sort of
> allocator object that is guaranteed to return buffers correctly aligned
> for the read and write operations.
>

The solution can be that, if someone needs real asynchronous AIO for
files in linux, that it patch its kernel, or that it takes care of
using O_DIRECT flag and aligning the buffers manually before using it
with asio. Since, it can be that kernel 2.6 gets AIO soon(I dont have
any idea when it will happen), and then we would have useless code and
interface in the library...
Well, just a though, I'm still not sure...

> > Any feedback will be appreciated.
>
> My only suggestion at this time is that rather than trying to
> reimplement all the demuxer code (for doing dispatch(), post() etc),
> just use the task_demuxer_service and implement the aio code as a task.
> A task must have the following interface:
>
> class Task
> {
> public:
> void reset(); // Reset in preparation for a new run() call.
> void run(); // Perform operations until interrupted.
> void interrupt(); // Stop an existing run loop.
> };
>
> Note that the interrupt() function must be able to be called from a
> different thread to run().
>
> You then use your demuxer like so:
>
> typedef basic_demuxer<
> detail::task_demuxer_service<detail::aio_task> > aio_demuxer;

I think I missed this part of the code, now that I looked better I'm
certain this is the best way to do it.
Could you give me a rationale of the Task concept name?

>
> If you look at the select_reactor or epoll_reactor you will see that
> they implement the above Task concept, but they also support running
> themselves in a separate thread. This is one way to have aio for files
> and select_reactor/epoll_reactor for sockets coexist in the same
> demuxer object.

It is in the top of my TODO list.
Next in this list is a little more though about basic_stream_file's constructor.

>
> Cheers,
> Chris

Thanks very much,

-- 
   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