… | |
… | |
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 |
… | |
… | |
194 | use strict 'vars'; |
193 | use strict 'vars'; |
195 | |
194 | |
196 | use base 'Exporter'; |
195 | use base 'Exporter'; |
197 | |
196 | |
198 | BEGIN { |
197 | BEGIN { |
199 | our $VERSION = '2.62'; |
198 | our $VERSION = '3.03'; |
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 |
… | |
… | |
1118 | See C<poll_cb> for an example. |
1117 | See C<poll_cb> for an example. |
1119 | |
1118 | |
1120 | =item IO::AIO::poll_cb |
1119 | =item IO::AIO::poll_cb |
1121 | |
1120 | |
1122 | Process some outstanding events on the result pipe. You have to call this |
1121 | Process some outstanding events on the result pipe. You have to call this |
1123 | regularly. Returns the number of events processed. Returns immediately |
1122 | regularly. Returns C<0> if all events could be processed, or C<-1> if it |
|
|
1123 | returned earlier for whatever reason. Returns immediately when no events |
1124 | when no events are outstanding. The amount of events processed depends on |
1124 | are outstanding. The amount of events processed depends on the settings of |
1125 | the settings of C<IO::AIO::max_poll_req> and C<IO::AIO::max_poll_time>. |
1125 | C<IO::AIO::max_poll_req> and C<IO::AIO::max_poll_time>. |
1126 | |
1126 | |
1127 | If not all requests were processed for whatever reason, the filehandle |
1127 | If not all requests were processed for whatever reason, the filehandle |
1128 | will still be ready when C<poll_cb> returns. |
1128 | will still be ready when C<poll_cb> returns, so normally you don't have to |
|
|
1129 | do anything special to have it called later. |
1129 | |
1130 | |
1130 | Example: Install an Event watcher that automatically calls |
1131 | Example: Install an Event watcher that automatically calls |
1131 | IO::AIO::poll_cb with high priority: |
1132 | IO::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 | |
1343 | Known bugs will be fixed in the next release. |
1344 | Known bugs will be fixed in the next release. |
1344 | |
1345 | |
1345 | =head1 SEE ALSO |
1346 | =head1 SEE ALSO |
1346 | |
1347 | |
1347 | L<Coro::AIO>. |
1348 | L<AnyEvent::AIO> for easy integration into event loops, L<Coro::AIO> for a |
|
|
1349 | more 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/ |