--- IO-AIO/AIO.pm 2015/06/25 15:20:11 1.255 +++ IO-AIO/AIO.pm 2016/02/23 19:42:43 1.259 @@ -96,7 +96,7 @@ print $contents; # exit event loop and program - EV::unloop; + EV::break; }; }; @@ -104,7 +104,7 @@ # check for sockets etc. etc. # process events as long as there are some: - EV::loop; + EV::run; =head1 REQUEST ANATOMY AND LIFETIME @@ -169,13 +169,13 @@ use base 'Exporter'; BEGIN { - our $VERSION = 4.32; + our $VERSION = 4.33; our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx - aio_scandir aio_symlink aio_readlink aio_realpath aio_sync - aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range aio_allocate - aio_pathsync aio_readahead aio_fiemap + aio_scandir aio_symlink aio_readlink aio_realpath aio_fcntl aio_ioctl + aio_sync aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range + aio_pathsync aio_readahead aio_fiemap aio_allocate aio_rename aio_link aio_move aio_copy aio_group aio_nop aio_mknod aio_load aio_rmtree aio_mkdir aio_chown aio_chmod aio_utime aio_truncate @@ -242,6 +242,8 @@ aio_copy $srcpath, $dstpath, $callback->($status) aio_move $srcpath, $dstpath, $callback->($status) aio_rmtree $pathname, $callback->($status) + aio_fcntl $fh, $cmd, $arg, $callback->($status) + aio_ioctl $fh, $request, $buf, $callback->($status) aio_sync $callback->($status) aio_syncfs $fh, $callback->($status) aio_fsync $fh, $callback->($status) @@ -628,8 +630,9 @@ 0x0000f15f ecryptfs 0x00414a53 efs 0x0000137d ext - 0x0000ef53 ext2/ext3 + 0x0000ef53 ext2/ext3/ext4 0x0000ef51 ext2 + 0xf2f52010 f2fs 0x00004006 fat 0x65735546 fuseblk 0x65735543 fusectl @@ -638,6 +641,7 @@ 0x47504653 gpfs 0x00004244 hfs 0xf995e849 hpfs + 0x00c0ffee hostfs 0x958458f6 hugetlbfs 0x2bad1dea inotifyfs 0x00009660 isofs @@ -662,6 +666,7 @@ 0x00009fa0 proc 0x6165676c pstorefs 0x0000002f qnx4 + 0x68191122 qnx6 0x858458f6 ramfs 0x52654973 reiserfs 0x00007275 romfs @@ -1226,6 +1231,25 @@ $grp } +=item aio_fcntl $fh, $cmd, $arg, $callback->($status) + +=item aio_ioctl $fh, $request, $buf, $callback->($status) + +These work just like the C and C built-in functions, except +they execute asynchronously and pass the return value to the callback. + +Both calls can be used for a lot of things, some of which make more sense +to run asynchronously in their own thread, while some others make less +sense. For example, calls that block waiting for external events, such +as locking, will also lock down an I/O thread while it is waiting, which +can deadlock the whole I/O system. At the same time, there might be no +alternative to using a thread to wait. + +So in general, you should only use these calls for things that do +(filesystem) I/O, not for things that wait for other events (network, +other processes), although if you are careful and know what you are doing, +you still can. + =item aio_sync $callback->($status) Asynchronously call sync and call the callback when finished. @@ -2059,13 +2083,20 @@ C<$prot> is a combination of C, C, C and/or C, -C<$flags> can be a combination of C or -C, or a number of system-specific flags (when -not available, the are defined as 0): C -(which is set to C if your system only provides this -constant), C, C, -C, C or -C +C<$flags> can be a combination of +C or +C, +or a number of system-specific flags (when not available, the are C<0>): +C (which is set to C if your system only provides this constant), +C, +C, +C, +C, +C, +C, +C, +C or +C. If C<$fh> is C, then a file descriptor of C<-1> is passed.