--- IO-AIO/README 2016/01/18 11:53:09 1.57 +++ IO-AIO/README 2016/05/01 17:19:39 1.58 @@ -186,6 +186,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) @@ -890,6 +892,24 @@ uses "aio_scandir" to recurse into and rmdir directories, and unlink everything else. + aio_fcntl $fh, $cmd, $arg, $callback->($status) + aio_ioctl $fh, $request, $buf, $callback->($status) + These work just like the "fcntl" and "ioctl" 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. + aio_sync $callback->($status) Asynchronously call sync and call the callback when finished. @@ -1640,11 +1660,11 @@ "IO::AIO::MAP_PRIVATE", or a number of system-specific flags (when not available, the are 0): "IO::AIO::MAP_ANONYMOUS" (which is set to "MAP_ANON" if your system only provides this constant), - "IO::AIO::MAP_HUGETLB", "IO::AIO::MAP_LOCKED", - "IO::AIO::MAP_NORESERVE", "IO::AIO::MAP_POPULATE", - "IO::AIO::MAP_NONBLOCK", "IO::AIO::MAP_FIXED", - "IO::AIO::MAP_GROWSDOWN", "IO::AIO::MAP_32BIT", - "IO::AIO::MAP_HUGETLB" or "IO::AIO::MAP_STACK". + "IO::AIO::MAP_LOCKED", "IO::AIO::MAP_NORESERVE", + "IO::AIO::MAP_POPULATE", "IO::AIO::MAP_NONBLOCK", + "IO::AIO::MAP_FIXED", "IO::AIO::MAP_GROWSDOWN", + "IO::AIO::MAP_32BIT", "IO::AIO::MAP_HUGETLB" or + "IO::AIO::MAP_STACK". If $fh is "undef", then a file descriptor of -1 is passed.