--- IO-AIO/README 2005/07/10 21:04:46 1.4 +++ IO-AIO/README 2005/07/10 23:45:16 1.5 @@ -4,6 +4,30 @@ SYNOPSIS use IO::AIO; + aio_open "/etc/passwd", O_RDONLY, 0, sub { + my ($fh) = @_; + ... + }; + + aio_unlink "/tmp/file", sub { }; + + aio_read $fh, 30000, 1024, $buffer, 0, sub { + $_[0] > 0 or die "read error: $!"; + }; + + # Event + Event->io (fd => IO::AIO::poll_fileno, + poll => 'r', + cb => \&IO::AIO::poll_cb); + + # Glib/Gtk2 + add_watch Glib::IO IO::AIO::poll_fileno, + \&IO::AIO::poll_cb; + + # Tk + Tk::Event::IO->fileevent (IO::AIO::poll_fileno, "", + readable => \&IO::AIO::poll_cb); + DESCRIPTION This module implements asynchronous I/O using whatever means your operating system supports. @@ -78,8 +102,8 @@ offset 0 within the scalar: aio_read $fh, 7, 15, $buffer, 0, sub { - $_[0] >= 0 or die "read error: $!"; - print "read <$buffer>\n"; + $_[0] > 0 or die "read error: $!"; + print "read $_[0] bytes: <$buffer>\n"; }; aio_readahead $fh,$offset,$length, $callback