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.90 by root, Mon Oct 30 23:30:00 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
189use strict 'vars'; 190use strict 'vars';
190 191
191use base 'Exporter'; 192use base 'Exporter';
192 193
193BEGIN { 194BEGIN {
194 our $VERSION = '2.1'; 195 our $VERSION = '2.2';
195 196
196 our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close aio_stat 197 our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close aio_stat
197 aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink 198 aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink
198 aio_readlink aio_fsync aio_fdatasync aio_readahead aio_rename aio_link 199 aio_readlink aio_fsync aio_fdatasync aio_readahead aio_rename aio_link
199 aio_move aio_copy aio_group aio_nop aio_mknod); 200 aio_move aio_copy aio_group aio_nop aio_mknod);
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
977If there are any outstanding requests and none of them in the result
976Wait till the result filehandle becomes ready for reading (simply does a 978phase, wait till the result filehandle becomes ready for reading (simply
977C<select> on the filehandle. This is useful if you want to synchronously 979does a C<select> on the filehandle. This is useful if you want to
978wait 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
984Waits until some requests have been handled. 986Waits until some requests have been handled.
985 987
988Returns the number of requests processed, but is otherwise strictly
986Strictly equivalent to: 989equivalent to:
987 990
988 IO::AIO::poll_wait, IO::AIO::poll_cb 991 IO::AIO::poll_wait, IO::AIO::poll_cb
989 if IO::AIO::nreqs;
990 992
991=item IO::AIO::flush 993=item IO::AIO::flush
992 994
993Wait till all outstanding AIO requests have been handled. 995Wait till all outstanding AIO requests have been handled.
994 996

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines