ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/README
(Generate patch)

Comparing IO-AIO/README (file contents):
Revision 1.29 by root, Wed Apr 16 16:45:30 2008 UTC vs.
Revision 1.31 by root, Thu May 29 03:35:03 2008 UTC

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
748 747
749 See "poll_cb" for an example. 748 See "poll_cb" for an example.
750 749
751 IO::AIO::poll_cb 750 IO::AIO::poll_cb
752 Process some outstanding events on the result pipe. You have to call 751 Process some outstanding events on the result pipe. You have to call
753 this regularly. Returns the number of events processed. Returns 752 this regularly. Returns 0 if all events could be processed, or -1 if
754 immediately when no events are outstanding. The amount of events 753 it returned earlier for whatever reason. Returns immediately when no
754 events are outstanding. The amount of events processed depends on
755 processed depends on the settings of "IO::AIO::max_poll_req" and 755 the settings of "IO::AIO::max_poll_req" and
756 "IO::AIO::max_poll_time". 756 "IO::AIO::max_poll_time".
757 757
758 If not all requests were processed for whatever reason, the 758 If not all requests were processed for whatever reason, the
759 filehandle will still be ready when "poll_cb" returns. 759 filehandle will still be ready when "poll_cb" returns, so normally
760 you don't have to do anything special to have it called later.
760 761
761 Example: Install an Event watcher that automatically calls 762 Example: Install an Event watcher that automatically calls
762 IO::AIO::poll_cb with high priority: 763 IO::AIO::poll_cb with high priority:
763 764
764 Event->io (fd => IO::AIO::poll_fileno, 765 Event->io (fd => IO::AIO::poll_fileno,
870 871
871 The default is probably ok in most situations, especially if thread 872 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 873 creation is fast. If thread creation is very slow on your system you
873 might want to use larger values. 874 might want to use larger values.
874 875
875 $oldmaxreqs = IO::AIO::max_outstanding $maxreqs 876 IO::AIO::max_outstanding $maxreqs
876 This is a very bad function to use in interactive programs because 877 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 878 it blocks, and a bad way to reduce concurrency because it is
878 inexact: Better use an "aio_group" together with a feed callback. 879 inexact: Better use an "aio_group" together with a feed callback.
879 880
880 Sets the maximum number of outstanding requests to $nreqs. If you do 881 Sets the maximum number of outstanding requests to $nreqs. If you do
884 885
885 The default value is very large, so there is no practical limit on 886 The default value is very large, so there is no practical limit on
886 the number of outstanding requests. 887 the number of outstanding requests.
887 888
888 You can still queue as many requests as you want. Therefore, 889 You can still queue as many requests as you want. Therefore,
889 "max_oustsanding" is mainly useful in simple scripts (with low 890 "max_outstanding" is mainly useful in simple scripts (with low
890 values) or as a stop gap to shield against fatal memory overflow 891 values) or as a stop gap to shield against fatal memory overflow
891 (with large values). 892 (with large values).
892 893
893 STATISTICAL INFORMATION 894 STATISTICAL INFORMATION
894 IO::AIO::nreqs 895 IO::AIO::nreqs
944 945
945KNOWN BUGS 946KNOWN BUGS
946 Known bugs will be fixed in the next release. 947 Known bugs will be fixed in the next release.
947 948
948SEE ALSO 949SEE ALSO
949 Coro::AIO. 950 AnyEvent::AIO for easy integration into event loops, Coro::AIO for a
951 more natural syntax.
950 952
951AUTHOR 953AUTHOR
952 Marc Lehmann <schmorp@schmorp.de> 954 Marc Lehmann <schmorp@schmorp.de>
953 http://home.schmorp.de/ 955 http://home.schmorp.de/
954 956

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines