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.21 by root, Sat Jan 15 00:05:14 2005 UTC vs.
Revision 1.26 by root, Thu Jul 7 23:17:23 2005 UTC

32package Linux::AIO; 32package Linux::AIO;
33 33
34use base 'Exporter'; 34use base 'Exporter';
35 35
36BEGIN { 36BEGIN {
37 $VERSION = 1.4; 37 $VERSION = 1.6;
38 38
39 @EXPORT = qw(aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink); 39 @EXPORT = qw(aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink);
40 @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel nreqs); 40 @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel nreqs);
41 41
42 require XSLoader; 42 require XSLoader;
47 47
48Set the minimum number of AIO threads to C<$nthreads>. The default is 48Set the minimum number of AIO threads to C<$nthreads>. The default is
49C<1>, which means a single asynchronous operation can be done at one time 49C<1>, which means a single asynchronous operation can be done at one time
50(the number of outstanding operations, however, is unlimited). 50(the number of outstanding operations, however, is unlimited).
51 51
52It is recommended to keep the number of threads low, as many linux 52It is recommended to keep the number of threads low, as some linux
53kernel versions will scale negatively with the number of threads (higher 53kernel versions will scale negatively with the number of threads (higher
54parallelity => MUCH higher latency). 54parallelity => MUCH higher latency).
55
56=item Linux::AIO::max_parallel $nthreads
57
58Sets the maximum number of AIO threads to C<$nthreads>. If more than
59the specified number of threads are currently running, kill them. This
60function blocks until the limit is reached.
61
62This module automatically runs C<max_parallel 0> at program end, to ensure
63that all threads are killed and that there are no outstanding requests.
55 64
56=item $fileno = Linux::AIO::poll_fileno 65=item $fileno = Linux::AIO::poll_fileno
57 66
58Return the I<request result pipe filehandle>. This filehandle must be 67Return the I<request result pipe filehandle>. This filehandle must be
59polled for reading by some mechanism outside this module (e.g. Event 68polled for reading by some mechanism outside this module (e.g. Event
70 79
71 Event->io (fd => Linux::AIO::poll_fileno, 80 Event->io (fd => Linux::AIO::poll_fileno,
72 poll => 'r', async => 1, 81 poll => 'r', async => 1,
73 cb => \&Linux::AIO::poll_cb ); 82 cb => \&Linux::AIO::poll_cb );
74 83
84=item Linux::AIO::poll_wait
85
86Wait till the result filehandle becomes ready for reading (simply does a
87select on the filehandle. This is useful if you want to synchronously wait
88for some requests to finish).
75 89
76=item Linux::AIO::nreqs 90=item Linux::AIO::nreqs
77 91
78Returns the number of requests currently outstanding. 92Returns the number of requests currently outstanding.
79 93
134 148
135L<Coro>. 149L<Coro>.
136 150
137=head1 AUTHOR 151=head1 AUTHOR
138 152
139 Marc Lehmann <pcg@goof.com> 153 Marc Lehmann <schmorp@schmorp.de>
140 http://home.schmorp.de/ 154 http://home.schmorp.de/
141 155
142=cut 156=cut
143 157

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines