ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/AIO.pm
(Generate patch)

Comparing IO-AIO/AIO.pm (file contents):
Revision 1.124 by root, Sat May 10 19:25:33 2008 UTC vs.
Revision 1.129 by root, Tue Jun 17 23:38:10 2008 UTC

26 $req->cancel; # cancel request if still in queue 26 $req->cancel; # cancel request if still in queue
27 27
28 my $grp = aio_group sub { print "all stats done\n" }; 28 my $grp = aio_group sub { print "all stats done\n" };
29 add $grp aio_stat "..." for ...; 29 add $grp aio_stat "..." for ...;
30 30
31 # AnyEvent integration (EV, Event, Glib, Tk, urxvt, pureperl...) 31 # AnyEvent integration (EV, Event, Glib, Tk, POE, urxvt, pureperl...)
32 open my $fh, "<&=" . IO::AIO::poll_fileno or die "$!"; 32 use AnyEvent::AIO;
33 my $w = AnyEvent->io (fh => $fh, poll => 'r', cb => sub { IO::AIO::poll_cb });
34 33
35 # EV integration 34 # EV integration
36 my $w = EV::io IO::AIO::poll_fileno, EV::READ, \&IO::AIO::poll_cb; 35 my $w = EV::io IO::AIO::poll_fileno, EV::READ, \&IO::AIO::poll_cb;
37 36
38 # Event integration 37 # Event integration
194use strict 'vars'; 193use strict 'vars';
195 194
196use base 'Exporter'; 195use base 'Exporter';
197 196
198BEGIN { 197BEGIN {
199 our $VERSION = '3.0'; 198 our $VERSION = '3.04';
200 199
201 our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close 200 our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close
202 aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir 201 aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir
203 aio_scandir aio_symlink aio_readlink aio_sync aio_fsync 202 aio_scandir aio_symlink aio_readlink aio_sync aio_fsync
204 aio_fdatasync aio_pathsync aio_readahead 203 aio_fdatasync aio_pathsync aio_readahead
1118See C<poll_cb> for an example. 1117See C<poll_cb> for an example.
1119 1118
1120=item IO::AIO::poll_cb 1119=item IO::AIO::poll_cb
1121 1120
1122Process some outstanding events on the result pipe. You have to call this 1121Process some outstanding events on the result pipe. You have to call this
1123regularly. Returns the number of events processed. Returns immediately 1122regularly. Returns C<0> if all events could be processed, or C<-1> if it
1123returned earlier for whatever reason. Returns immediately when no events
1124when no events are outstanding. The amount of events processed depends on 1124are outstanding. The amount of events processed depends on the settings of
1125the settings of C<IO::AIO::max_poll_req> and C<IO::AIO::max_poll_time>. 1125C<IO::AIO::max_poll_req> and C<IO::AIO::max_poll_time>.
1126 1126
1127If not all requests were processed for whatever reason, the filehandle 1127If not all requests were processed for whatever reason, the filehandle
1128will still be ready when C<poll_cb> returns. 1128will still be ready when C<poll_cb> returns, so normally you don't have to
1129do anything special to have it called later.
1129 1130
1130Example: Install an Event watcher that automatically calls 1131Example: Install an Event watcher that automatically calls
1131IO::AIO::poll_cb with high priority: 1132IO::AIO::poll_cb with high priority:
1132 1133
1133 Event->io (fd => IO::AIO::poll_fileno, 1134 Event->io (fd => IO::AIO::poll_fileno,
1342 1343
1343Known bugs will be fixed in the next release. 1344Known bugs will be fixed in the next release.
1344 1345
1345=head1 SEE ALSO 1346=head1 SEE ALSO
1346 1347
1347L<Coro::AIO>. 1348L<AnyEvent::AIO> for easy integration into event loops, L<Coro::AIO> for a
1349more natural syntax.
1348 1350
1349=head1 AUTHOR 1351=head1 AUTHOR
1350 1352
1351 Marc Lehmann <schmorp@schmorp.de> 1353 Marc Lehmann <schmorp@schmorp.de>
1352 http://home.schmorp.de/ 1354 http://home.schmorp.de/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines