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