… | |
… | |
24 | $req->cancel; # cancel request if still in queue |
24 | $req->cancel; # cancel request if still in queue |
25 | |
25 | |
26 | my $grp = aio_group sub { print "all stats done\n" }; |
26 | my $grp = aio_group sub { print "all stats done\n" }; |
27 | add $grp aio_stat "..." for ...; |
27 | add $grp aio_stat "..." for ...; |
28 | |
28 | |
29 | # AnyEvent integration (EV, Event, Glib, Tk, urxvt, pureperl...) |
29 | # AnyEvent integration (EV, Event, Glib, Tk, POE, urxvt, pureperl...) |
30 | open my $fh, "<&=" . IO::AIO::poll_fileno or die "$!"; |
30 | use AnyEvent::AIO; |
31 | my $w = AnyEvent->io (fh => $fh, poll => 'r', cb => sub { IO::AIO::poll_cb }); |
|
|
32 | |
31 | |
33 | # EV integration |
32 | # EV integration |
34 | my $w = EV::io IO::AIO::poll_fileno, EV::READ, \&IO::AIO::poll_cb; |
33 | my $w = EV::io IO::AIO::poll_fileno, EV::READ, \&IO::AIO::poll_cb; |
35 | |
34 | |
36 | # Event integration |
35 | # Event integration |
… | |
… | |
870 | |
869 | |
871 | The default is probably ok in most situations, especially if thread |
870 | The default is probably ok in most situations, especially if thread |
872 | creation is fast. If thread creation is very slow on your system you |
871 | creation is fast. If thread creation is very slow on your system you |
873 | might want to use larger values. |
872 | might want to use larger values. |
874 | |
873 | |
875 | $oldmaxreqs = IO::AIO::max_outstanding $maxreqs |
874 | IO::AIO::max_outstanding $maxreqs |
876 | This is a very bad function to use in interactive programs because |
875 | This is a very bad function to use in interactive programs because |
877 | it blocks, and a bad way to reduce concurrency because it is |
876 | it blocks, and a bad way to reduce concurrency because it is |
878 | inexact: Better use an "aio_group" together with a feed callback. |
877 | inexact: Better use an "aio_group" together with a feed callback. |
879 | |
878 | |
880 | Sets the maximum number of outstanding requests to $nreqs. If you do |
879 | Sets the maximum number of outstanding requests to $nreqs. If you do |
… | |
… | |
884 | |
883 | |
885 | The default value is very large, so there is no practical limit on |
884 | The default value is very large, so there is no practical limit on |
886 | the number of outstanding requests. |
885 | the number of outstanding requests. |
887 | |
886 | |
888 | You can still queue as many requests as you want. Therefore, |
887 | You can still queue as many requests as you want. Therefore, |
889 | "max_oustsanding" is mainly useful in simple scripts (with low |
888 | "max_outstanding" is mainly useful in simple scripts (with low |
890 | values) or as a stop gap to shield against fatal memory overflow |
889 | values) or as a stop gap to shield against fatal memory overflow |
891 | (with large values). |
890 | (with large values). |
892 | |
891 | |
893 | STATISTICAL INFORMATION |
892 | STATISTICAL INFORMATION |
894 | IO::AIO::nreqs |
893 | IO::AIO::nreqs |
… | |
… | |
944 | |
943 | |
945 | KNOWN BUGS |
944 | KNOWN BUGS |
946 | Known bugs will be fixed in the next release. |
945 | Known bugs will be fixed in the next release. |
947 | |
946 | |
948 | SEE ALSO |
947 | SEE ALSO |
949 | Coro::AIO. |
948 | AnyEvent::AIO for easy integration into event loops, Coro::AIO for a |
|
|
949 | more natural syntax. |
950 | |
950 | |
951 | AUTHOR |
951 | AUTHOR |
952 | Marc Lehmann <schmorp@schmorp.de> |
952 | Marc Lehmann <schmorp@schmorp.de> |
953 | http://home.schmorp.de/ |
953 | http://home.schmorp.de/ |
954 | |
954 | |