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.42 by root, Mon Dec 26 18:15:23 2005 UTC vs.
Revision 1.46 by root, Mon Dec 26 20:17:13 2005 UTC

67use base 'Exporter'; 67use base 'Exporter';
68 68
69use Fcntl (); 69use Fcntl ();
70 70
71BEGIN { 71BEGIN {
72 $VERSION = '1.61'; 72 $VERSION = '1.71';
73 73
74 @EXPORT = qw(aio_sendfile aio_read aio_write aio_open aio_close aio_stat 74 @EXPORT = qw(aio_sendfile aio_read aio_write aio_open aio_close aio_stat
75 aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink 75 aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink
76 aio_fsync aio_fdatasync aio_readahead); 76 aio_fsync aio_fdatasync aio_readahead);
77 @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel 77 @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel
237=item aio_rmdir $pathname, $callback->($status) 237=item aio_rmdir $pathname, $callback->($status)
238 238
239Asynchronously rmdir (delete) a directory and call the callback with the 239Asynchronously rmdir (delete) a directory and call the callback with the
240result code. 240result code.
241 241
242=item aio_readdir $pathname $callback->($entries) 242=item aio_readdir $pathname, $callback->($entries)
243 243
244Unlike the POSIX call of the same name, C<aio_readdir> reads an entire 244Unlike the POSIX call of the same name, C<aio_readdir> reads an entire
245directory (i.e. opendir + readdir + closedir). The entries will not be 245directory (i.e. opendir + readdir + closedir). The entries will not be
246sorted, and will B<NOT> include the C<.> and C<..> entries. 246sorted, and will B<NOT> include the C<.> and C<..> entries.
247 247
319 $ndirs = -1; 319 $ndirs = -1;
320 } else { 320 } else {
321 # if nlink == 2, we are finished 321 # if nlink == 2, we are finished
322 # on non-posix-fs's, we rely on nlink < 2 322 # on non-posix-fs's, we rely on nlink < 2
323 $ndirs = (stat _)[3] - 2 323 $ndirs = (stat _)[3] - 2
324 or $cb->([], $entries); 324 or return $cb->([], $entries);
325 } 325 }
326 326
327 # sort into likely dirs and likely nondirs 327 # sort into likely dirs and likely nondirs
328 # dirs == files without ".", short entries first 328 # dirs == files without ".", short entries first
329 $entries = [map $_->[0], 329 $entries = [map $_->[0],
345 } 345 }
346 } elsif (!$nreq) { 346 } elsif (!$nreq) {
347 # finished 347 # finished
348 undef $statcb; 348 undef $statcb;
349 undef $schedcb; 349 undef $schedcb;
350 $cb->(\@dirs, \@nondirs); 350 $cb->(\@dirs, \@nondirs) if $cb;
351 undef $cb; 351 undef $cb;
352 } 352 }
353 }; 353 };
354 $statcb = sub { 354 $statcb = sub {
355 my ($status, $entry) = @_; 355 my ($status, $entry) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines