… | |
… | |
206 | XSLoader::load ("IO::AIO", $VERSION); |
206 | XSLoader::load ("IO::AIO", $VERSION); |
207 | } |
207 | } |
208 | |
208 | |
209 | =head1 FUNCTIONS |
209 | =head1 FUNCTIONS |
210 | |
210 | |
211 | =head2 AIO FUNCTIONS |
211 | =head2 AIO REQUEST FUNCTIONS |
212 | |
212 | |
213 | All the C<aio_*> calls are more or less thin wrappers around the syscall |
213 | All the C<aio_*> calls are more or less thin wrappers around the syscall |
214 | with the same name (sans C<aio_>). The arguments are similar or identical, |
214 | with the same name (sans C<aio_>). The arguments are similar or identical, |
215 | and they all accept an additional (and optional) C<$callback> argument |
215 | and they all accept an additional (and optional) C<$callback> argument |
216 | which must be a code reference. This code reference will get called with |
216 | which must be a code reference. This code reference will get called with |
… | |
… | |
219 | syscall has been executed asynchronously. |
219 | syscall has been executed asynchronously. |
220 | |
220 | |
221 | All functions expecting a filehandle keep a copy of the filehandle |
221 | All functions expecting a filehandle keep a copy of the filehandle |
222 | internally until the request has finished. |
222 | internally until the request has finished. |
223 | |
223 | |
224 | All requests return objects of type L<IO::AIO::REQ> that allow further |
224 | All functions return request objects of type L<IO::AIO::REQ> that allow |
225 | manipulation of those requests while they are in-flight. |
225 | further manipulation of those requests while they are in-flight. |
226 | |
226 | |
227 | The pathnames you pass to these routines I<must> be absolute and |
227 | The pathnames you pass to these routines I<must> be absolute and |
228 | encoded in byte form. The reason for the former is that at the time the |
228 | encoded as octets. The reason for the former is that at the time the |
229 | request is being executed, the current working directory could have |
229 | request is being executed, the current working directory could have |
230 | changed. Alternatively, you can make sure that you never change the |
230 | changed. Alternatively, you can make sure that you never change the |
231 | current working directory. |
231 | current working directory anywhere in the program and then use relative |
|
|
232 | paths. |
232 | |
233 | |
233 | To encode pathnames to byte form, either make sure you either: a) |
234 | To encode pathnames as octets, either make sure you either: a) always pass |
234 | always pass in filenames you got from outside (command line, readdir |
235 | in filenames you got from outside (command line, readdir etc.) without |
235 | etc.), b) are ASCII or ISO 8859-1, c) use the Encode module and encode |
236 | tinkering, b) are ASCII or ISO 8859-1, c) use the Encode module and encode |
236 | your pathnames to the locale (or other) encoding in effect in the user |
237 | your pathnames to the locale (or other) encoding in effect in the user |
237 | environment, d) use Glib::filename_from_unicode on unicode filenames or e) |
238 | environment, d) use Glib::filename_from_unicode on unicode filenames or e) |
238 | use something else. |
239 | use something else to ensure your scalar has the correct contents. |
|
|
240 | |
|
|
241 | This works, btw. independent of the internal UTF-8 bit, which IO::AIO |
|
|
242 | handles correctly wether it is set or not. |
239 | |
243 | |
240 | =over 4 |
244 | =over 4 |
241 | |
245 | |
242 | =item $prev_pri = aioreq_pri [$pri] |
246 | =item $prev_pri = aioreq_pri [$pri] |
243 | |
247 | |
… | |
… | |
266 | }; |
270 | }; |
267 | |
271 | |
268 | =item aioreq_nice $pri_adjust |
272 | =item aioreq_nice $pri_adjust |
269 | |
273 | |
270 | Similar to C<aioreq_pri>, but subtracts the given value from the current |
274 | Similar to C<aioreq_pri>, but subtracts the given value from the current |
271 | priority, so effects are cumulative. |
275 | priority, so the effect is cumulative. |
272 | |
276 | |
273 | =item aio_open $pathname, $flags, $mode, $callback->($fh) |
277 | =item aio_open $pathname, $flags, $mode, $callback->($fh) |
274 | |
278 | |
275 | Asynchronously open or create a file and call the callback with a newly |
279 | Asynchronously open or create a file and call the callback with a newly |
276 | created filehandle for the file. |
280 | created filehandle for the file. |