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.22 by root, Sat Jan 6 02:47:11 2007 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
384 will not be sorted, and will NOT include the "." and ".." entries. 385 will not be sorted, and will NOT include the "." and ".." entries.
385 386
386 The callback a single argument which is either "undef" or an 387 The callback a single argument which is either "undef" or an
387 array-ref with the filenames. 388 array-ref with the filenames.
388 389
390 aio_load $path, $data, $callback->($status)
391 This is a composite request that tries to fully load the given file
392 into memory. Status is the same as with aio_read.
393
389 aio_copy $srcpath, $dstpath, $callback->($status) 394 aio_copy $srcpath, $dstpath, $callback->($status)
390 Try to copy the *file* (directories not supported as either source 395 Try to copy the *file* (directories not supported as either source
391 or destination) from $srcpath to $dstpath and call the callback with 396 or destination) from $srcpath to $dstpath and call the callback with
392 the 0 (error) or -1 ok. 397 the 0 (error) or -1 ok.
393 398
711 Event->io (fd => IO::AIO::poll_fileno, 716 Event->io (fd => IO::AIO::poll_fileno,
712 poll => 'r', nice => 1, 717 poll => 'r', nice => 1,
713 cb => &IO::AIO::poll_cb); 718 cb => &IO::AIO::poll_cb);
714 719
715 IO::AIO::poll_wait 720 IO::AIO::poll_wait
721 If there are any outstanding requests and none of them in the result
716 Wait till the result filehandle becomes ready for reading (simply 722 phase, wait till the result filehandle becomes ready for reading
717 does a "select" on the filehandle. This is useful if you want to 723 (simply does a "select" on the filehandle. This is useful if you
718 synchronously wait for some requests to finish). 724 want to synchronously wait for some requests to finish).
719 725
720 See "nreqs" for an example. 726 See "nreqs" for an example.
721 727
722 IO::AIO::poll 728 IO::AIO::poll
723 Waits until some requests have been handled. 729 Waits until some requests have been handled.
724 730
731 Returns the number of requests processed, but is otherwise strictly
725 Strictly equivalent to: 732 equivalent to:
726 733
727 IO::AIO::poll_wait, IO::AIO::poll_cb 734 IO::AIO::poll_wait, IO::AIO::poll_cb
728 if IO::AIO::nreqs;
729 735
730 IO::AIO::flush 736 IO::AIO::flush
731 Wait till all outstanding AIO requests have been handled. 737 Wait till all outstanding AIO requests have been handled.
732 738
733 Strictly equivalent to: 739 Strictly equivalent to:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines