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.98 by root, Sun Dec 31 17:07:32 2006 UTC vs.
Revision 1.99 by root, Sun Jan 7 21:32:20 2007 UTC

190use strict 'vars'; 190use strict 'vars';
191 191
192use base 'Exporter'; 192use base 'Exporter';
193 193
194BEGIN { 194BEGIN {
195 our $VERSION = '2.31'; 195 our $VERSION = '2.32';
196 196
197 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
198 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
199 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
200 aio_move aio_copy aio_group aio_nop aio_mknod aio_load); 200 aio_move aio_copy aio_group aio_nop aio_mknod aio_load aio_rmtree);
201 our @EXPORT = (@AIO_REQ, qw(aioreq_pri aioreq_nice aio_block)); 201 our @EXPORT = (@AIO_REQ, qw(aioreq_pri aioreq_nice aio_block));
202 our @EXPORT_OK = qw(poll_fileno poll_cb poll_wait flush 202 our @EXPORT_OK = qw(poll_fileno poll_cb poll_wait flush
203 min_parallel max_parallel max_idle 203 min_parallel max_parallel max_idle
204 nreqs nready npending nthreads 204 nreqs nready npending nthreads
205 max_poll_time max_poll_reqs); 205 max_poll_time max_poll_reqs);
722 722
723 $grp 723 $grp
724 } 724 }
725} 725}
726 726
727=item aio_rmtree $path, $callback->($status)
728
729Delete a directory tree starting (and including) C<$path>, return the status of the final C<rmdir> only.
730This is a composite request that uses C<aio_scandir> to recurse into and rmdir directories, and
731unlink everything else.
732
733=cut
734
735sub aio_rmtree;
736sub aio_rmtree {
737 aio_block {
738 my ($path, $cb) = @_;
739
740 my $pri = aioreq_pri;
741 my $grp = aio_group $cb;
742
743 aioreq_pri $pri;
744 add $grp aio_scandir $path, 0, sub {
745 my ($dirs, $nondirs) = @_;
746
747 my $dirgrp = aio_group sub {
748 add $grp aio_rmdir $path, sub {
749 $grp->result ($_[0]);
750 };
751 };
752
753 (aioreq_pri $pri), add $dirgrp aio_rmtree "$path/$_" for @$dirs;
754 (aioreq_pri $pri), add $dirgrp aio_unlink "$path/$_" for @$nondirs;
755
756 add $grp $dirgrp;
757 };
758
759 $grp
760 }
761}
762
727=item aio_fsync $fh, $callback->($status) 763=item aio_fsync $fh, $callback->($status)
728 764
729Asynchronously call fsync on the given filehandle and call the callback 765Asynchronously call fsync on the given filehandle and call the callback
730with the fsync result code. 766with the fsync result code.
731 767

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines