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.194 by root, Fri May 27 00:44:49 2011 UTC vs.
Revision 1.195 by root, Fri May 27 19:56:31 2011 UTC

1564Sets the minimum idle timeout (default 10) after which worker threads are 1564Sets the minimum idle timeout (default 10) after which worker threads are
1565allowed to exit. SEe C<IO::AIO::max_idle>. 1565allowed to exit. SEe C<IO::AIO::max_idle>.
1566 1566
1567=item IO::AIO::max_outstanding $maxreqs 1567=item IO::AIO::max_outstanding $maxreqs
1568 1568
1569Sets the maximum number of outstanding requests to C<$nreqs>. If
1570you do queue up more than this number of requests, the next call to
1571C<IO::AIO::poll_cb> (and other functions calling C<poll_cb>, such as
1572C<IO::AIO::flush> or C<IO::AIO::poll>) will block until the limit is no
1573longer exceeded.
1574
1575In other words, this setting does not enforce a queue limit, but can be
1576used to make poll functions block if the limit is exceeded.
1577
1569This is a very bad function to use in interactive programs because it 1578This is a very bad function to use in interactive programs because it
1570blocks, and a bad way to reduce concurrency because it is inexact: Better 1579blocks, and a bad way to reduce concurrency because it is inexact: Better
1571use an C<aio_group> together with a feed callback. 1580use an C<aio_group> together with a feed callback.
1572 1581
1573Sets the maximum number of outstanding requests to C<$nreqs>. If you 1582It's main use is in scripts without an event loop - when you want to stat
1574do queue up more than this number of requests, the next call to the 1583a lot of files, you can write somehting like this:
1575C<poll_cb> (and C<poll_some> and other functions calling C<poll_cb>)
1576function will block until the limit is no longer exceeded.
1577 1584
1578The default value is very large, so there is no practical limit on the 1585 IO::AIO::max_outstanding 32;
1579number of outstanding requests.
1580 1586
1581You can still queue as many requests as you want. Therefore, 1587 for my $path (...) {
1582C<max_outstanding> is mainly useful in simple scripts (with low values) or 1588 aio_stat $path , ...;
1583as a stop gap to shield against fatal memory overflow (with large values). 1589 IO::AIO::poll_cb;
1590 }
1591
1592 IO::AIO::flush;
1593
1594The call to C<poll_cb> inside the loop will normally return instantly, but
1595as soon as more thna C<32> reqeusts are in-flight, it will block until
1596some requests have been handled. This keeps the loop from pushing a large
1597number of C<aio_stat> requests onto the queue.
1598
1599The default value for C<max_outstanding> is very large, so there is no
1600practical limit on the number of outstanding requests.
1584 1601
1585=back 1602=back
1586 1603
1587=head3 STATISTICAL INFORMATION 1604=head3 STATISTICAL INFORMATION
1588 1605

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines