… | |
… | |
189 | use strict 'vars'; |
189 | use strict 'vars'; |
190 | |
190 | |
191 | use base 'Exporter'; |
191 | use base 'Exporter'; |
192 | |
192 | |
193 | BEGIN { |
193 | BEGIN { |
194 | our $VERSION = '2.4'; |
194 | our $VERSION = '2.41'; |
195 | |
195 | |
196 | our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close aio_stat |
196 | our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close aio_stat |
197 | aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink |
197 | aio_lstat aio_unlink aio_rmdir aio_readdir aio_scandir aio_symlink |
198 | aio_readlink aio_fsync aio_fdatasync aio_readahead aio_rename aio_link |
198 | aio_readlink aio_fsync aio_fdatasync aio_readahead aio_rename aio_link |
199 | aio_move aio_copy aio_group aio_nop aio_mknod aio_load aio_rmtree aio_mkdir |
199 | aio_move aio_copy aio_group aio_nop aio_mknod aio_load aio_rmtree aio_mkdir |
… | |
… | |
329 | Reads or writes C<$length> bytes from the specified C<$fh> and C<$offset> |
329 | Reads or writes C<$length> bytes from the specified C<$fh> and C<$offset> |
330 | into the scalar given by C<$data> and offset C<$dataoffset> and calls the |
330 | into the scalar given by C<$data> and offset C<$dataoffset> and calls the |
331 | callback without the actual number of bytes read (or -1 on error, just |
331 | callback without the actual number of bytes read (or -1 on error, just |
332 | like the syscall). |
332 | like the syscall). |
333 | |
333 | |
334 | If C<$offset> is undefined, then the current file offset will be used (and |
334 | If C<$offset> is undefined, then the current file descriptor offset will |
335 | updated), otherwise the file offset will not be changed by these calls. |
335 | be used (and updated), otherwise the file descriptor offset will not be |
|
|
336 | changed by these calls. |
336 | |
337 | |
337 | If C<$length> is undefined in C<aio_write>, use the remaining length of C<$data>. |
338 | If C<$length> is undefined in C<aio_write>, use the remaining length of C<$data>. |
338 | |
339 | |
339 | If C<$dataoffset> is less than zero, it will be counted from the end of |
340 | If C<$dataoffset> is less than zero, it will be counted from the end of |
340 | C<$data>. |
341 | C<$data>. |
341 | |
342 | |
342 | The C<$data> scalar I<MUST NOT> be modified in any way while the request |
343 | The C<$data> scalar I<MUST NOT> be modified in any way while the request |
… | |
… | |
1206 | This is a very bad function to use in interactive programs because it |
1207 | This is a very bad function to use in interactive programs because it |
1207 | blocks, and a bad way to reduce concurrency because it is inexact: Better |
1208 | blocks, and a bad way to reduce concurrency because it is inexact: Better |
1208 | use an C<aio_group> together with a feed callback. |
1209 | use an C<aio_group> together with a feed callback. |
1209 | |
1210 | |
1210 | Sets the maximum number of outstanding requests to C<$nreqs>. If you |
1211 | Sets the maximum number of outstanding requests to C<$nreqs>. If you |
1211 | to queue up more than this number of requests, the next call to the |
1212 | do queue up more than this number of requests, the next call to the |
1212 | C<poll_cb> (and C<poll_some> and other functions calling C<poll_cb>) |
1213 | C<poll_cb> (and C<poll_some> and other functions calling C<poll_cb>) |
1213 | function will block until the limit is no longer exceeded. |
1214 | function will block until the limit is no longer exceeded. |
1214 | |
1215 | |
1215 | The default value is very large, so there is no practical limit on the |
1216 | The default value is very large, so there is no practical limit on the |
1216 | number of outstanding requests. |
1217 | number of outstanding requests. |
… | |
… | |
1295 | bytes of memory. In addition, stat requests need a stat buffer (possibly |
1296 | bytes of memory. In addition, stat requests need a stat buffer (possibly |
1296 | a few hundred bytes), readdir requires a result buffer and so on. Perl |
1297 | a few hundred bytes), readdir requires a result buffer and so on. Perl |
1297 | scalars and other data passed into aio requests will also be locked and |
1298 | scalars and other data passed into aio requests will also be locked and |
1298 | will consume memory till the request has entered the done state. |
1299 | will consume memory till the request has entered the done state. |
1299 | |
1300 | |
1300 | This is now awfully much, so queuing lots of requests is not usually a |
1301 | This is not awfully much, so queuing lots of requests is not usually a |
1301 | problem. |
1302 | problem. |
1302 | |
1303 | |
1303 | Per-thread usage: |
1304 | Per-thread usage: |
1304 | |
1305 | |
1305 | In the execution phase, some aio requests require more memory for |
1306 | In the execution phase, some aio requests require more memory for |