… | |
… | |
204 | IO::AIO::max_poll_reqs $nreqs |
204 | IO::AIO::max_poll_reqs $nreqs |
205 | IO::AIO::max_poll_time $seconds |
205 | IO::AIO::max_poll_time $seconds |
206 | IO::AIO::min_parallel $nthreads |
206 | IO::AIO::min_parallel $nthreads |
207 | IO::AIO::max_parallel $nthreads |
207 | IO::AIO::max_parallel $nthreads |
208 | IO::AIO::max_idle $nthreads |
208 | IO::AIO::max_idle $nthreads |
|
|
209 | IO::AIO::idle_timeout $seconds |
209 | IO::AIO::max_outstanding $maxreqs |
210 | IO::AIO::max_outstanding $maxreqs |
210 | IO::AIO::nreqs |
211 | IO::AIO::nreqs |
211 | IO::AIO::nready |
212 | IO::AIO::nready |
212 | IO::AIO::npending |
213 | IO::AIO::npending |
213 | |
214 | |
… | |
… | |
413 | |
414 | |
414 | Currently, the stats are always 64-bit-stats, i.e. instead of |
415 | Currently, the stats are always 64-bit-stats, i.e. instead of |
415 | returning an error when stat'ing a large file, the results will be |
416 | returning an error when stat'ing a large file, the results will be |
416 | silently truncated unless perl itself is compiled with large file |
417 | silently truncated unless perl itself is compiled with large file |
417 | support. |
418 | support. |
|
|
419 | |
|
|
420 | To help interpret the mode and dev/rdev stat values, IO::AIO offers |
|
|
421 | the following constants and functions (if not implemented, the |
|
|
422 | constants will be 0 and the functions will either "croak" or fall |
|
|
423 | back on traditional behaviour). |
|
|
424 | |
|
|
425 | "S_IFMT", "S_IFIFO", "S_IFCHR", "S_IFBLK", "S_IFLNK", "S_IFREG", |
|
|
426 | "S_IFDIR", "S_IFWHT", "S_IFSOCK", "IO::AIO::major $dev_t", |
|
|
427 | "IO::AIO::minor $dev_t", "IO::AIO::makedev $major, $minor". |
418 | |
428 | |
419 | Example: Print the length of /etc/passwd: |
429 | Example: Print the length of /etc/passwd: |
420 | |
430 | |
421 | aio_stat "/etc/passwd", sub { |
431 | aio_stat "/etc/passwd", sub { |
422 | $_[0] and die "stat failed: $!"; |
432 | $_[0] and die "stat failed: $!"; |
… | |
… | |
511 | |
521 | |
512 | The only (POSIX-) portable way of calling this function is: |
522 | The only (POSIX-) portable way of calling this function is: |
513 | |
523 | |
514 | aio_mknod $path, IO::AIO::S_IFIFO | $mode, 0, sub { ... |
524 | aio_mknod $path, IO::AIO::S_IFIFO | $mode, 0, sub { ... |
515 | |
525 | |
|
|
526 | See "aio_stat" for info about some potentially helpful extra |
|
|
527 | constants and functions. |
|
|
528 | |
516 | aio_link $srcpath, $dstpath, $callback->($status) |
529 | aio_link $srcpath, $dstpath, $callback->($status) |
517 | Asynchronously create a new link to the existing object at $srcpath |
530 | Asynchronously create a new link to the existing object at $srcpath |
518 | at the path $dstpath and call the callback with the result code. |
531 | at the path $dstpath and call the callback with the result code. |
519 | |
532 | |
520 | aio_symlink $srcpath, $dstpath, $callback->($status) |
533 | aio_symlink $srcpath, $dstpath, $callback->($status) |
… | |
… | |
1121 | |
1134 | |
1122 | Under normal circumstances you don't need to call this function. |
1135 | Under normal circumstances you don't need to call this function. |
1123 | |
1136 | |
1124 | IO::AIO::max_idle $nthreads |
1137 | IO::AIO::max_idle $nthreads |
1125 | Limit the number of threads (default: 4) that are allowed to idle |
1138 | Limit the number of threads (default: 4) that are allowed to idle |
1126 | (i.e., threads that did not get a request to process within 10 |
1139 | (i.e., threads that did not get a request to process within the idle |
1127 | seconds). That means if a thread becomes idle while $nthreads other |
1140 | timeout (default: 10 seconds). That means if a thread becomes idle |
1128 | threads are also idle, it will free its resources and exit. |
1141 | while $nthreads other threads are also idle, it will free its |
|
|
1142 | resources and exit. |
1129 | |
1143 | |
1130 | This is useful when you allow a large number of threads (e.g. 100 or |
1144 | This is useful when you allow a large number of threads (e.g. 100 or |
1131 | 1000) to allow for extremely high load situations, but want to free |
1145 | 1000) to allow for extremely high load situations, but want to free |
1132 | resources under normal circumstances (1000 threads can easily |
1146 | resources under normal circumstances (1000 threads can easily |
1133 | consume 30MB of RAM). |
1147 | consume 30MB of RAM). |
1134 | |
1148 | |
1135 | The default is probably ok in most situations, especially if thread |
1149 | The default is probably ok in most situations, especially if thread |
1136 | creation is fast. If thread creation is very slow on your system you |
1150 | creation is fast. If thread creation is very slow on your system you |
1137 | might want to use larger values. |
1151 | might want to use larger values. |
|
|
1152 | |
|
|
1153 | IO::AIO::idle_timeout $seconds |
|
|
1154 | Sets the minimum idle timeout (default 10) after which worker |
|
|
1155 | threads are allowed to exit. SEe "IO::AIO::max_idle". |
1138 | |
1156 | |
1139 | IO::AIO::max_outstanding $maxreqs |
1157 | IO::AIO::max_outstanding $maxreqs |
1140 | This is a very bad function to use in interactive programs because |
1158 | This is a very bad function to use in interactive programs because |
1141 | it blocks, and a bad way to reduce concurrency because it is |
1159 | it blocks, and a bad way to reduce concurrency because it is |
1142 | inexact: Better use an "aio_group" together with a feed callback. |
1160 | inexact: Better use an "aio_group" together with a feed callback. |