… | |
… | |
190 | use strict 'vars'; |
190 | use strict 'vars'; |
191 | |
191 | |
192 | use base 'Exporter'; |
192 | use base 'Exporter'; |
193 | |
193 | |
194 | BEGIN { |
194 | BEGIN { |
195 | our $VERSION = '2.32'; |
195 | our $VERSION = '2.33'; |
196 | |
196 | |
197 | our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close aio_stat |
197 | our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close aio_stat |
198 | aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink |
198 | aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink |
199 | aio_readlink aio_fsync aio_fdatasync aio_readahead aio_rename aio_link |
199 | aio_readlink aio_fsync aio_fdatasync aio_readahead aio_rename aio_link |
200 | aio_move aio_copy aio_group aio_nop aio_mknod aio_load aio_rmtree aio_mkdir); |
200 | aio_move aio_copy aio_group aio_nop aio_mknod aio_load aio_rmtree aio_mkdir); |
… | |
… | |
469 | my $pri = aioreq_pri; |
469 | my $pri = aioreq_pri; |
470 | my $grp = aio_group $cb; |
470 | my $grp = aio_group $cb; |
471 | |
471 | |
472 | aioreq_pri $pri; |
472 | aioreq_pri $pri; |
473 | add $grp aio_open $path, O_RDONLY, 0, sub { |
473 | add $grp aio_open $path, O_RDONLY, 0, sub { |
474 | my ($fh) = @_ |
474 | my $fh = shift |
475 | or return $grp->result (-1); |
475 | or return $grp->result (-1); |
476 | |
476 | |
477 | aioreq_pri $pri; |
477 | aioreq_pri $pri; |
478 | add $grp aio_read $fh, 0, (-s $fh), $$data, 0, sub { |
478 | add $grp aio_read $fh, 0, (-s $fh), $$data, 0, sub { |
479 | $grp->result ($_[0]); |
479 | $grp->result ($_[0]); |
… | |
… | |
1078 | Strictly equivalent to: |
1078 | Strictly equivalent to: |
1079 | |
1079 | |
1080 | IO::AIO::poll_wait, IO::AIO::poll_cb |
1080 | IO::AIO::poll_wait, IO::AIO::poll_cb |
1081 | while IO::AIO::nreqs; |
1081 | while IO::AIO::nreqs; |
1082 | |
1082 | |
|
|
1083 | =back |
|
|
1084 | |
1083 | =head3 CONTROLLING THE NUMBER OF THREADS |
1085 | =head3 CONTROLLING THE NUMBER OF THREADS |
1084 | |
1086 | |
1085 | =item IO::AIO::min_parallel $nthreads |
1087 | =item IO::AIO::min_parallel $nthreads |
1086 | |
1088 | |
1087 | Set the minimum number of AIO threads to C<$nthreads>. The current |
1089 | Set the minimum number of AIO threads to C<$nthreads>. The current |
… | |
… | |
1147 | |
1149 | |
1148 | You can still queue as many requests as you want. Therefore, |
1150 | You can still queue as many requests as you want. Therefore, |
1149 | C<max_oustsanding> is mainly useful in simple scripts (with low values) or |
1151 | C<max_oustsanding> is mainly useful in simple scripts (with low values) or |
1150 | as a stop gap to shield against fatal memory overflow (with large values). |
1152 | as a stop gap to shield against fatal memory overflow (with large values). |
1151 | |
1153 | |
|
|
1154 | =back |
|
|
1155 | |
1152 | =head3 STATISTICAL INFORMATION |
1156 | =head3 STATISTICAL INFORMATION |
|
|
1157 | |
|
|
1158 | =over |
1153 | |
1159 | |
1154 | =item IO::AIO::nreqs |
1160 | =item IO::AIO::nreqs |
1155 | |
1161 | |
1156 | Returns the number of requests currently in the ready, execute or pending |
1162 | Returns the number of requests currently in the ready, execute or pending |
1157 | states (i.e. for which their callback has not been invoked yet). |
1163 | states (i.e. for which their callback has not been invoked yet). |