--- IO-AIO/AIO.pm 2006/10/24 03:17:39 1.68 +++ IO-AIO/AIO.pm 2006/10/24 03:40:38 1.70 @@ -83,7 +83,7 @@ aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink aio_fsync aio_fdatasync aio_readahead aio_rename aio_link aio_move aio_group aio_nop); - our @EXPORT = (@AIO_REQ, qw(aioreq_pri)); + our @EXPORT = (@AIO_REQ, qw(aioreq_pri aioreq_nice)); our @EXPORT_OK = qw(poll_fileno poll_cb poll_wait flush min_parallel max_parallel max_outstanding nreqs); @@ -135,6 +135,25 @@ The priority will be reset to C<0> after each call to one of the C functions. +Example: open a file with low priority, then read something from it with +higher priority so the read request is serviced before other low priority +open requests (potentially spamming the cache): + + aioreq_pri -3; + aio_open ..., sub { + return unless $_[0]; + + aioreq_pri -2; + aio_read $_[0], ..., sub { + ... + }; + }; + +=item aioreq_nice $pri_adjust + +Similar to C, but subtracts the given value from the current +priority, so effects are cumulative. + =item aio_open $pathname, $flags, $mode, $callback->($fh) Asynchronously open or create a file and call the callback with a newly