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.188 by root, Tue Feb 15 03:21:41 2011 UTC vs.
Revision 1.193 by root, Thu May 26 04:15:37 2011 UTC

168use common::sense; 168use common::sense;
169 169
170use base 'Exporter'; 170use base 'Exporter';
171 171
172BEGIN { 172BEGIN {
173 our $VERSION = '3.72'; 173 our $VERSION = '3.8';
174 174
175 our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close 175 our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close
176 aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx 176 aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx
177 aio_scandir aio_symlink aio_readlink aio_sync aio_fsync 177 aio_scandir aio_symlink aio_readlink aio_sync aio_fsync
178 aio_fdatasync aio_sync_file_range aio_pathsync aio_readahead 178 aio_fdatasync aio_sync_file_range aio_pathsync aio_readahead
668 668
669=over 4 669=over 4
670 670
671=item IO::AIO::READDIR_DENTS 671=item IO::AIO::READDIR_DENTS
672 672
673When this flag is off, then the callback gets an arrayref with of names 673When this flag is off, then the callback gets an arrayref consisting of
674only (as with C<aio_readdir>), otherwise it gets an arrayref with 674names only (as with C<aio_readdir>), otherwise it gets an arrayref with
675C<[$name, $type, $inode]> arrayrefs, each describing a single directory 675C<[$name, $type, $inode]> arrayrefs, each describing a single directory
676entry in more detail. 676entry in more detail.
677 677
678C<$name> is the name of the entry. 678C<$name> is the name of the entry.
679 679
692systems that do not deliver the inode information. 692systems that do not deliver the inode information.
693 693
694=item IO::AIO::READDIR_DIRS_FIRST 694=item IO::AIO::READDIR_DIRS_FIRST
695 695
696When this flag is set, then the names will be returned in an order where 696When this flag is set, then the names will be returned in an order where
697likely directories come first. This is useful when you need to quickly 697likely directories come first, in optimal stat order. This is useful when
698find directories, or you want to find all directories while avoiding to 698you need to quickly find directories, or you want to find all directories
699stat() each entry. 699while avoiding to stat() each entry.
700 700
701If the system returns type information in readdir, then this is used 701If the system returns type information in readdir, then this is used
702to find directories directly. Otherwise, likely directories are files 702to find directories directly. Otherwise, likely directories are names
703beginning with ".", or otherwise files with no dots, of which files with 703beginning with ".", or otherwise names with no dots, of which names with
704short names are tried first. 704short names are tried first.
705 705
706=item IO::AIO::READDIR_STAT_ORDER 706=item IO::AIO::READDIR_STAT_ORDER
707 707
708When this flag is set, then the names will be returned in an order 708When this flag is set, then the names will be returned in an order
1406 1406
1407See C<poll_cb> for an example. 1407See C<poll_cb> for an example.
1408 1408
1409=item IO::AIO::poll_cb 1409=item IO::AIO::poll_cb
1410 1410
1411Process some outstanding events on the result pipe. You have to call this 1411Process some outstanding events on the result pipe. You have to call
1412regularly. Returns C<0> if all events could be processed, or C<-1> if it 1412this regularly. Returns C<0> if all events could be processed (or there
1413returned earlier for whatever reason. Returns immediately when no events 1413were no events to process), or C<-1> if it returned earlier for whatever
1414are outstanding. The amount of events processed depends on the settings of 1414reason. Returns immediately when no events are outstanding. The amount of
1415C<IO::AIO::max_poll_req> and C<IO::AIO::max_poll_time>. 1415events processed depends on the settings of C<IO::AIO::max_poll_req> and
1416C<IO::AIO::max_poll_time>.
1416 1417
1417If not all requests were processed for whatever reason, the filehandle 1418If not all requests were processed for whatever reason, the filehandle
1418will still be ready when C<poll_cb> returns, so normally you don't have to 1419will still be ready when C<poll_cb> returns, so normally you don't have to
1419do anything special to have it called later. 1420do anything special to have it called later.
1421
1422Apart from calling C<IO::AIO::poll_cb> when the event filehandle becomes
1423ready, it can be beneficial to call this function from loops which submit
1424a lot of requests, to make sure the results get processed when they become
1425available and not just when the loop is finished and the event loop takes
1426over again. This function returns very fast when there are no outstanding
1427requests.
1420 1428
1421Example: Install an Event watcher that automatically calls 1429Example: Install an Event watcher that automatically calls
1422IO::AIO::poll_cb with high priority (more examples can be found in the 1430IO::AIO::poll_cb with high priority (more examples can be found in the
1423SYNOPSIS section, at the top of this document): 1431SYNOPSIS section, at the top of this document):
1424 1432

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines