… | |
… | |
443 | recurse into (everything else, including symlinks to directories). |
443 | recurse into (everything else, including symlinks to directories). |
444 | |
444 | |
445 | C<aio_scandir> is a composite request that creates of many sub requests_ |
445 | C<aio_scandir> is a composite request that creates of many sub requests_ |
446 | C<$maxreq> specifies the maximum number of outstanding aio requests that |
446 | C<$maxreq> specifies the maximum number of outstanding aio requests that |
447 | this function generates. If it is C<< <= 0 >>, then a suitable default |
447 | this function generates. If it is C<< <= 0 >>, then a suitable default |
448 | will be chosen (currently 6). |
448 | will be chosen (currently 4). |
449 | |
449 | |
450 | On error, the callback is called without arguments, otherwise it receives |
450 | On error, the callback is called without arguments, otherwise it receives |
451 | two array-refs with path-relative entry names. |
451 | two array-refs with path-relative entry names. |
452 | |
452 | |
453 | Example: |
453 | Example: |
… | |
… | |
494 | |
494 | |
495 | my $pri = aioreq_pri; |
495 | my $pri = aioreq_pri; |
496 | |
496 | |
497 | my $grp = aio_group $cb; |
497 | my $grp = aio_group $cb; |
498 | |
498 | |
499 | $maxreq = 6 if $maxreq <= 0; |
499 | $maxreq = 4 if $maxreq <= 0; |
500 | |
500 | |
501 | # stat once |
501 | # stat once |
502 | aioreq_pri $pri; |
502 | aioreq_pri $pri; |
503 | add $grp aio_stat $path, sub { |
503 | add $grp aio_stat $path, sub { |
504 | return $grp->result () if $_[0]; |
504 | return $grp->result () if $_[0]; |
… | |
… | |
955 | *$sym |
955 | *$sym |
956 | } |
956 | } |
957 | |
957 | |
958 | min_parallel 8; |
958 | min_parallel 8; |
959 | |
959 | |
960 | END { |
|
|
961 | max_parallel 0; |
|
|
962 | } |
|
|
963 | |
|
|
964 | 1; |
960 | 1; |
965 | |
961 | |
966 | =head2 FORK BEHAVIOUR |
962 | =head2 FORK BEHAVIOUR |
967 | |
963 | |
968 | This module should do "the right thing" when the process using it forks: |
964 | This module should do "the right thing" when the process using it forks: |