… | |
… | |
132 | is C<0>, the minimum and maximum priorities are C<-4> and C<4>, |
132 | is C<0>, the minimum and maximum priorities are C<-4> and C<4>, |
133 | respectively. Requests with higher priority will be serviced first. |
133 | respectively. Requests with higher priority will be serviced first. |
134 | |
134 | |
135 | The priority will be reset to C<0> after each call to one of the C<aio_> |
135 | The priority will be reset to C<0> after each call to one of the C<aio_> |
136 | functions. |
136 | functions. |
|
|
137 | |
|
|
138 | Example: open a file with low priority, then read something from it with |
|
|
139 | higher priority so the read request is serviced before other low priority |
|
|
140 | open requests (potentially spamming the cache): |
|
|
141 | |
|
|
142 | aioreq_pri -3; |
|
|
143 | aio_open ..., sub { |
|
|
144 | return unless $_[0]; |
|
|
145 | |
|
|
146 | aioreq_pri -2; |
|
|
147 | aio_read $_[0], ..., sub { |
|
|
148 | ... |
|
|
149 | }; |
|
|
150 | }; |
|
|
151 | |
|
|
152 | =item aioreq_nice $pri_adjust |
|
|
153 | |
|
|
154 | Similar to C<aioreq_pri>, but subtracts the given value from the current |
|
|
155 | priority, so effects are cumulative. |
137 | |
156 | |
138 | =item aio_open $pathname, $flags, $mode, $callback->($fh) |
157 | =item aio_open $pathname, $flags, $mode, $callback->($fh) |
139 | |
158 | |
140 | Asynchronously open or create a file and call the callback with a newly |
159 | Asynchronously open or create a file and call the callback with a newly |
141 | created filehandle for the file. |
160 | created filehandle for the file. |