For Programmers: Free Programming Magazines  


Home > Archive > PERL POE > December 2006 > when working with files under POE, shouldn't IO::AIO be used?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author when working with files under POE, shouldn't IO::AIO be used?
aninnymouse@gmail.com

2006-12-11, 7:34 pm

To avoid blocking when doing file operations under POE, shouldn't
IO::AIO be used? I haven't seen any mention or examples of two being
used together. If somebody has done this already, can they post an
example here or on the wiki. Thanks.

Also, there was a brief mention [1] on the djabberd mailing list that
Brad would like to bring Danga::Socket and POE together. Any thoughts
from this camp?

[1] http://lists.danga.com/pipermail/dj...ber/000198.html

Guillermo Roditi

2006-12-11, 7:34 pm

IO::AIO is b0rken for FreeBSD. I know because I tried to use it for
POCO::DirWatch::Object...




On 9 Dec 2006 21:37:14 -0800, aninnymouse@gmail.com <aninnymouse@gmail.com>
wrote:
>
> To avoid blocking when doing file operations under POE, shouldn't
> IO::AIO be used? I haven't seen any mention or examples of two being
> used together. If somebody has done this already, can they post an
> example here or on the wiki. Thanks.
>
> Also, there was a brief mention [1] on the djabberd mailing list that
> Brad would like to bring Danga::Socket and POE together. Any thoughts
> from this camp?
>
> [1] http://lists.danga.com/pipermail/dj...ber/000198.html
>
>


Matt Sickler

2006-12-11, 7:34 pm

why use IO::AIO when there is POE::Wheel::ReadWrite?

On 9 Dec 2006 21:37:14 -0800, aninnymouse@gmail.com <aninnymouse@gmail.com>
wrote:
>
> To avoid blocking when doing file operations under POE, shouldn't
> IO::AIO be used? I haven't seen any mention or examples of two being
> used together. If somebody has done this already, can they post an
> example here or on the wiki. Thanks.
>
> Also, there was a brief mention [1] on the djabberd mailing list that
> Brad would like to bring Danga::Socket and POE together. Any thoughts
> from this camp?
>
> [1] http://lists.danga.com/pipermail/dj...ber/000198.html
>
>


aninnymouse@gmail.com

2006-12-11, 7:34 pm

According to the documentation that only does buffered I/O. There are
many other file operations that can block, which IO::AIO deals with-
file opening and creation, closing and deletion, link/symlink, stat,
rename, etc. Does POE handle those as well?

Matt Sickler wrote:
> why use IO::AIO when there is POE::Wheel::ReadWrite?
>
> On 9 Dec 2006 21:37:14 -0800, aninnymouse@gmail.com <aninnymouse@gmail.com>
> wrote:
>
> ------=_Part_72409_23861310.1165808259206--


Rocco Caputo

2006-12-14, 4:26 am

Although Marc Lehmann doesn't come out and say so, IO::AIO provides
two features that support its use from POE in a couple different ways.

It exposes a file descriptor, which can be used to notify select-like
loops when AIO operations are complete. For example:

# POE integration
open my $fh, "<&=" . IO::AIO::poll_fileno or die "$!";
$_[KERNEL]->select_read($fh, "aio_event");

Or you can use its callback mechanism with POE::Session's postback()
or callback():

aio_open "/etc/passwd", O_RDONLY, 0, $_[SESSION]->postback
("aio_open_event");

Whether you "should" use IO::AIO is a matter of your application's
requirements. Quite a lot of systems don't require AIO, so they
shouldn't use IO::AIO.

I hope this helps.

--
Rocco Caputo - rcaputo@pobox.com

On Dec 11, 2006, at 04:42, aninnymouse@gmail.com wrote:
[color=darkred]
> According to the documentation that only does buffered I/O. There are
> many other file operations that can block, which IO::AIO deals with-
> file opening and creation, closing and deletion, link/symlink, stat,
> rename, etc. Does POE handle those as well?
>
> Matt Sickler wrote:


David Davis

2006-12-14, 4:26 am

Here is my working example:

http://svn.xantus.org/shortbus/trun...perl/lab/aio.pl

David


On 12/13/06, Rocco Caputo <rcaputo@pobox.com> wrote:
>
> Although Marc Lehmann doesn't come out and say so, IO::AIO provides
> two features that support its use from POE in a couple different ways.
>
> It exposes a file descriptor, which can be used to notify select-like
> loops when AIO operations are complete. For example:
>
> # POE integration
> open my $fh, "<&=" . IO::AIO::poll_fileno or die "$!";
> $_[KERNEL]->select_read($fh, "aio_event");
>
> Or you can use its callback mechanism with POE::Session's postback()
> or callback():
>
> aio_open "/etc/passwd", O_RDONLY, 0, $_[SESSION]->postback
> ("aio_open_event");


Whether you "should" use IO::AIO is a matter of your application's
> requirements. Quite a lot of systems don't require AIO, so they
> shouldn't use IO::AIO.
>
> I hope this helps.
>
> --
> Rocco Caputo - rcaputo@pobox.com
>
> On Dec 11, 2006, at 04:42, aninnymouse@gmail.com wrote:
>
>
>
>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com