… | |
… | |
1759 | |
1759 | |
1760 | See C<poll_cb> for an example. |
1760 | See C<poll_cb> for an example. |
1761 | |
1761 | |
1762 | =item IO::AIO::poll_cb |
1762 | =item IO::AIO::poll_cb |
1763 | |
1763 | |
1764 | Process some outstanding events on the result pipe. You have to call |
1764 | Process some requests that have reached the result phase (i.e. they have |
|
|
1765 | been executed but the results are not yet reported). You have to call |
|
|
1766 | this "regularly" to finish outstanding requests. |
|
|
1767 | |
1765 | this regularly. Returns C<0> if all events could be processed (or there |
1768 | Returns C<0> if all events could be processed (or there were no |
1766 | were no events to process), or C<-1> if it returned earlier for whatever |
1769 | events to process), or C<-1> if it returned earlier for whatever |
1767 | reason. Returns immediately when no events are outstanding. The amount of |
1770 | reason. Returns immediately when no events are outstanding. The amount |
1768 | events processed depends on the settings of C<IO::AIO::max_poll_req> and |
1771 | of events processed depends on the settings of C<IO::AIO::max_poll_req>, |
1769 | C<IO::AIO::max_poll_time>. |
1772 | C<IO::AIO::max_poll_time> and C<IO::AIO::max_outstanding>. |
1770 | |
1773 | |
1771 | If not all requests were processed for whatever reason, the filehandle |
1774 | If not all requests were processed for whatever reason, the poll file |
1772 | will still be ready when C<poll_cb> returns, so normally you don't have to |
1775 | descriptor will still be ready when C<poll_cb> returns, so normally you |
1773 | do anything special to have it called later. |
1776 | don't have to do anything special to have it called later. |
1774 | |
1777 | |
1775 | Apart from calling C<IO::AIO::poll_cb> when the event filehandle becomes |
1778 | Apart from calling C<IO::AIO::poll_cb> when the event filehandle becomes |
1776 | ready, it can be beneficial to call this function from loops which submit |
1779 | ready, it can be beneficial to call this function from loops which submit |
1777 | a lot of requests, to make sure the results get processed when they become |
1780 | a lot of requests, to make sure the results get processed when they become |
1778 | available and not just when the loop is finished and the event loop takes |
1781 | available and not just when the loop is finished and the event loop takes |
… | |
… | |
1787 | poll => 'r', async => 1, |
1790 | poll => 'r', async => 1, |
1788 | cb => \&IO::AIO::poll_cb); |
1791 | cb => \&IO::AIO::poll_cb); |
1789 | |
1792 | |
1790 | =item IO::AIO::poll_wait |
1793 | =item IO::AIO::poll_wait |
1791 | |
1794 | |
1792 | If there are any outstanding requests and none of them in the result |
1795 | Wait until either at least one request is in the result phase or no |
1793 | phase, wait till the result filehandle becomes ready for reading (simply |
1796 | requests are outstanding anymore. |
1794 | does a C<select> on the filehandle. This is useful if you want to |
1797 | |
1795 | synchronously wait for some requests to finish). |
1798 | This is useful if you want to synchronously wait for some requests to |
|
|
1799 | become ready, without actually handling them. |
1796 | |
1800 | |
1797 | See C<nreqs> for an example. |
1801 | See C<nreqs> for an example. |
1798 | |
1802 | |
1799 | =item IO::AIO::poll |
1803 | =item IO::AIO::poll |
1800 | |
1804 | |