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.92 by root, Wed Nov 8 01:57:42 2006 UTC vs.
Revision 1.94 by root, Wed Nov 8 02:01:02 2006 UTC

5=head1 SYNOPSIS 5=head1 SYNOPSIS
6 6
7 use IO::AIO; 7 use IO::AIO;
8 8
9 aio_open "/etc/passwd", O_RDONLY, 0, sub { 9 aio_open "/etc/passwd", O_RDONLY, 0, sub {
10 my ($fh) = @_; 10 my $fh = shift
11 or die "/etc/passwd: $!";
11 ... 12 ...
12 }; 13 };
13 14
14 aio_unlink "/tmp/file", sub { }; 15 aio_unlink "/tmp/file", sub { };
15 16
99 poll => 'r', 100 poll => 'r',
100 cb => \&IO::AIO::poll_cb); 101 cb => \&IO::AIO::poll_cb);
101 102
102 # queue the request to open /etc/passwd 103 # queue the request to open /etc/passwd
103 aio_open "/etc/passwd", O_RDONLY, 0, sub { 104 aio_open "/etc/passwd", O_RDONLY, 0, sub {
104 my $fh = $_[0] 105 my $fh = shift
105 or die "error while opening: $!"; 106 or die "error while opening: $!";
106 107
107 # stat'ing filehandles is generally non-blocking 108 # stat'ing filehandles is generally non-blocking
108 my $size = -s $fh; 109 my $size = -s $fh;
109 110
971 poll => 'r', nice => 1, 972 poll => 'r', nice => 1,
972 cb => &IO::AIO::poll_cb); 973 cb => &IO::AIO::poll_cb);
973 974
974=item IO::AIO::poll_wait 975=item IO::AIO::poll_wait
975 976
976If there are any outstanding requests, wait till the result filehandle 977If there are any outstanding requests and none of them in the result
977becomes ready for reading (simply does a C<select> on the filehandle. This 978phase, wait till the result filehandle becomes ready for reading (simply
979does a C<select> on the filehandle. This is useful if you want to
978is useful if you want to synchronously wait for some requests to finish). 980synchronously wait for some requests to finish).
979 981
980See C<nreqs> for an example. 982See C<nreqs> for an example.
981 983
982=item IO::AIO::poll 984=item IO::AIO::poll
983 985
985 987
986Returns the number of requests processed, but is otherwise strictly 988Returns the number of requests processed, but is otherwise strictly
987equivalent to: 989equivalent to:
988 990
989 IO::AIO::poll_wait, IO::AIO::poll_cb 991 IO::AIO::poll_wait, IO::AIO::poll_cb
990 if IO::AIO::nreqs;
991 992
992=item IO::AIO::flush 993=item IO::AIO::flush
993 994
994Wait till all outstanding AIO requests have been handled. 995Wait till all outstanding AIO requests have been handled.
995 996

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines