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

Comparing Linux-AIO/AIO.pm (file contents):
Revision 1.3 by root, Tue Aug 14 23:25:39 2001 UTC vs.
Revision 1.7 by root, Mon Oct 8 12:58:41 2001 UTC

21package Linux::AIO; 21package Linux::AIO;
22 22
23use base 'Exporter'; 23use base 'Exporter';
24 24
25BEGIN { 25BEGIN {
26 $VERSION = 0.001; 26 $VERSION = 0.01;
27 27
28 @EXPORT = qw(aio_read aio_write); 28 @EXPORT = qw(aio_read aio_write aio_open aio_close);
29 @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel nreqs); 29 @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel nreqs);
30 30
31 require XSLoader; 31 require XSLoader;
32 XSLoader::load Linux::AIO, $VERSION; 32 XSLoader::load Linux::AIO, $VERSION;
33} 33}
35=item Linux::AIO::min_parallel($nthreads) 35=item Linux::AIO::min_parallel($nthreads)
36 36
37Set the minimum number of AIO threads to $nthreads. You I<have> to call 37Set the minimum number of AIO threads to $nthreads. You I<have> to call
38this function with a positive number at leats once, otherwise no threads 38this function with a positive number at leats once, otherwise no threads
39will be started and you aio-operations will seem to hang. 39will be started and you aio-operations will seem to hang.
40
41=cut
42
43=item aio_read($fh,$offset,$length, $data,$dataoffset,$callback)
44aio_write($fh,$offset,$length, $data,$dataoffset,$callback)
45
46Reads or writes C<length> bytes from the specified C<fh> and C<offset>
47into the scalar given by C<data> and offset C<dataoffset> and calls the
48callback without the actual number of bytes read (or undef on error).
49 40
50=item $fileno = Linux::AIO::poll_fileno 41=item $fileno = Linux::AIO::poll_fileno
51 42
52Return the request result pipe filehandle. This filehandle must be polled 43Return the request result pipe filehandle. This filehandle must be polled
53for reading. If the pipe becomes readable you have to call C<poll_cb>. 44for reading. If the pipe becomes readable you have to call C<poll_cb>.
66 57
67=item Linux::AIO::nreqs 58=item Linux::AIO::nreqs
68 59
69Returns the number of requests currently outstanding. 60Returns the number of requests currently outstanding.
70 61
62=item aio_read($fh,$offset,$length, $data,$dataoffset,$callback)
63aio_write($fh,$offset,$length, $data,$dataoffset,$callback)
64
65Reads or writes C<length> bytes from the specified C<fh> and C<offset>
66into the scalar given by C<data> and offset C<dataoffset> and calls the
67callback without the actual number of bytes read (or undef on error).
68
69=item aio_open($pathname, $flags, $mode, $callback)
70
71Asynchronously open or create a file and call the callback with the
72filedescriptor.
73
74=item aio_close($fh, $callback)
75
76Asynchronously close a file and call the callback with the result code.
77
71=cut 78=cut
72 79
73END { 80END {
74 max_parallel 0; 81 max_parallel 0;
75} 82}
80 87
81=head1 BUGS 88=head1 BUGS
82 89
83This module has not yet been extensively tested. Watch out! 90This module has not yet been extensively tested. Watch out!
84 91
92 - aio_stat/lstat are seriously missing here.
93
85=head1 SEE ALSO 94=head1 SEE ALSO
86 95
87L<Coro>. 96L<Coro>.
88 97
89=head1 AUTHOR 98=head1 AUTHOR

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines