… | |
… | |
66 | |
66 | |
67 | BEGIN { |
67 | BEGIN { |
68 | $VERSION = 1.1; |
68 | $VERSION = 1.1; |
69 | |
69 | |
70 | @EXPORT = qw(aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink |
70 | @EXPORT = qw(aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink |
71 | aio_fsync aio_fdatasync aio_readahead); |
71 | aio_rmdir aio_symlink aio_fsync aio_fdatasync aio_readahead); |
72 | @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel max_outstanding nreqs); |
72 | @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel max_outstanding nreqs); |
73 | |
73 | |
74 | require XSLoader; |
74 | require XSLoader; |
75 | XSLoader::load IO::AIO, $VERSION; |
75 | XSLoader::load IO::AIO, $VERSION; |
76 | } |
76 | } |
… | |
… | |
191 | =item aio_unlink $pathname, $callback |
191 | =item aio_unlink $pathname, $callback |
192 | |
192 | |
193 | Asynchronously unlink (delete) a file and call the callback with the |
193 | Asynchronously unlink (delete) a file and call the callback with the |
194 | result code. |
194 | result code. |
195 | |
195 | |
|
|
196 | =item aio_rmdir $pathname, $callback |
|
|
197 | |
|
|
198 | Asynchronously rmdir (delete) a directory and call the callback with the |
|
|
199 | result code. |
|
|
200 | |
196 | =item aio_fsync $fh, $callback |
201 | =item aio_fsync $fh, $callback |
197 | |
202 | |
198 | Asynchronously call fsync on the given filehandle and call the callback |
203 | Asynchronously call fsync on the given filehandle and call the callback |
199 | with the fsync result code. |
204 | with the fsync result code. |
200 | |
205 | |
… | |
… | |
318 | |
323 | |
319 | # try to generate nice filehandles |
324 | # try to generate nice filehandles |
320 | my $sym = "IO::AIO::fd#$_[0]"; |
325 | my $sym = "IO::AIO::fd#$_[0]"; |
321 | local *$sym; |
326 | local *$sym; |
322 | |
327 | |
323 | open *$sym, "+<&$_[0]" # usually under any unix |
328 | open *$sym, "+<&=$_[0]" # usually works under any unix |
324 | or open *$sym, "<&$_[0]" # cygwin needs this |
329 | or open *$sym, "<&=$_[0]" # cygwin needs this |
325 | or open *$sym, ">&$_[0]" # cygwin needs this |
330 | or open *$sym, ">&=$_[0]" # or this |
326 | or return undef; |
331 | or return undef; |
327 | |
332 | |
328 | *$sym |
333 | *$sym |
329 | } |
334 | } |
330 | |
335 | |
… | |
… | |
334 | max_parallel 0; |
339 | max_parallel 0; |
335 | } |
340 | } |
336 | |
341 | |
337 | 1; |
342 | 1; |
338 | |
343 | |
|
|
344 | =head2 FORK BEHAVIOUR |
|
|
345 | |
|
|
346 | IO::AIO handles all outstanding AIO requests before the fork, destroys all |
|
|
347 | AIO threads, and recreates them in both the parent and the child after the |
|
|
348 | fork. |
|
|
349 | |
|
|
350 | |
339 | =head1 SEE ALSO |
351 | =head1 SEE ALSO |
340 | |
352 | |
341 | L<Coro>, L<Linux::AIO>. |
353 | L<Coro>, L<Linux::AIO>. |
342 | |
354 | |
343 | =head1 AUTHOR |
355 | =head1 AUTHOR |