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.88 by root, Sun Oct 29 01:50:29 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines