Re: when working with files under POE, shouldn't IO::AIO be used?
by Rocco Caputo other posts by this author
Dec 13 2006 4:17PM messages near this date
Re: Buffering in PoCo::Child
|
Re: when working with files under POE, shouldn't IO::AIO be used?
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@[...].com
On Dec 11, 2006, at 04:42, aninnymouse@[...].com wrote:
> 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@[...].com
> > <aninnymouse@[...].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/djabberd/2006-October/
> >> 000198.html
> >>
> >>
> >
> > ------=_Part_72409_23861310.1165808259206--
Thread:
Rocco Caputo
David Davis
|