ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/AIO.pm
(Generate patch)

Comparing IO-AIO/AIO.pm (file contents):
Revision 1.86 by root, Sat Oct 28 23:32:29 2006 UTC vs.
Revision 1.87 by root, Sun Oct 29 00:52:02 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines