… | |
… | |
2 | Linux::AIO - linux-specific aio implemented using clone |
2 | Linux::AIO - linux-specific aio implemented using clone |
3 | |
3 | |
4 | SYNOPSIS |
4 | SYNOPSIS |
5 | use Linux::AIO; |
5 | use Linux::AIO; |
6 | |
6 | |
|
|
7 | # This module has been mostly superseded by IO::AIO. |
|
|
8 | |
7 | DESCRIPTION |
9 | DESCRIPTION |
|
|
10 | *This module has been mostly superseded by IO::AIO, which is API |
|
|
11 | compatible.* |
|
|
12 | |
8 | This module implements asynchronous I/O using the means available to |
13 | This module implements asynchronous I/O using the means available to |
9 | Linux - clone. It does not hook into the POSIX aio_* functions because |
14 | Linux - clone. It does not hook into the POSIX aio_* functions because |
10 | Linux does not yet support these in the kernel (even as of 2.6.12, only |
15 | Linux does not yet support these in the kernel (even as of 2.6.12, only |
11 | O_DIRECT files are supported) and even if, it would only allow aio_read |
16 | O_DIRECT files are supported) and even if, it would only allow aio_read |
12 | and write, not open, stat and so on. |
17 | and write, not open, stat and so on. |
… | |
… | |
110 | |
115 | |
111 | Example: |
116 | Example: |
112 | |
117 | |
113 | aio_open "/etc/passwd", O_RDONLY, 0, sub { |
118 | aio_open "/etc/passwd", O_RDONLY, 0, sub { |
114 | if ($_[0] >= 0) { |
119 | if ($_[0] >= 0) { |
115 | open my $fh, "<&$_[0]"; # create a copy for perl |
120 | open my $fh, "<&=$_[0]"; |
116 | aio_close $_[0], sub { }; # close the aio handle |
|
|
117 | print "open successful, fh is $fh\n"; |
121 | print "open successful, fh is $fh\n"; |
118 | ... |
122 | ... |
119 | } else { |
123 | } else { |
120 | die "open failed: $!\n"; |
124 | die "open failed: $!\n"; |
121 | } |
125 | } |