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

Comparing IO-AIO/README (file contents):
Revision 1.20 by root, Tue Oct 31 00:45:41 2006 UTC vs.
Revision 1.21 by root, Fri Dec 22 04:05:50 2006 UTC

3 3
4SYNOPSIS 4SYNOPSIS
5 use IO::AIO; 5 use IO::AIO;
6 6
7 aio_open "/etc/passwd", O_RDONLY, 0, sub { 7 aio_open "/etc/passwd", O_RDONLY, 0, sub {
8 my ($fh) = @_; 8 my $fh = shift
9 or die "/etc/passwd: $!";
9 ... 10 ...
10 }; 11 };
11 12
12 aio_unlink "/tmp/file", sub { }; 13 aio_unlink "/tmp/file", sub { };
13 14
95 poll => 'r', 96 poll => 'r',
96 cb => \&IO::AIO::poll_cb); 97 cb => \&IO::AIO::poll_cb);
97 98
98 # queue the request to open /etc/passwd 99 # queue the request to open /etc/passwd
99 aio_open "/etc/passwd", O_RDONLY, 0, sub { 100 aio_open "/etc/passwd", O_RDONLY, 0, sub {
100 my $fh = $_[0] 101 my $fh = shift
101 or die "error while opening: $!"; 102 or die "error while opening: $!";
102 103
103 # stat'ing filehandles is generally non-blocking 104 # stat'ing filehandles is generally non-blocking
104 my $size = -s $fh; 105 my $size = -s $fh;
105 106
711 Event->io (fd => IO::AIO::poll_fileno, 712 Event->io (fd => IO::AIO::poll_fileno,
712 poll => 'r', nice => 1, 713 poll => 'r', nice => 1,
713 cb => &IO::AIO::poll_cb); 714 cb => &IO::AIO::poll_cb);
714 715
715 IO::AIO::poll_wait 716 IO::AIO::poll_wait
717 If there are any outstanding requests and none of them in the result
716 Wait till the result filehandle becomes ready for reading (simply 718 phase, wait till the result filehandle becomes ready for reading
717 does a "select" on the filehandle. This is useful if you want to 719 (simply does a "select" on the filehandle. This is useful if you
718 synchronously wait for some requests to finish). 720 want to synchronously wait for some requests to finish).
719 721
720 See "nreqs" for an example. 722 See "nreqs" for an example.
721 723
722 IO::AIO::poll 724 IO::AIO::poll
723 Waits until some requests have been handled. 725 Waits until some requests have been handled.
724 726
727 Returns the number of requests processed, but is otherwise strictly
725 Strictly equivalent to: 728 equivalent to:
726 729
727 IO::AIO::poll_wait, IO::AIO::poll_cb 730 IO::AIO::poll_wait, IO::AIO::poll_cb
728 if IO::AIO::nreqs;
729 731
730 IO::AIO::flush 732 IO::AIO::flush
731 Wait till all outstanding AIO requests have been handled. 733 Wait till all outstanding AIO requests have been handled.
732 734
733 Strictly equivalent to: 735 Strictly equivalent to:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines