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.3 by root, Sun Jul 10 20:07:11 2005 UTC vs.
Revision 1.4 by root, Sun Jul 10 20:57:00 2005 UTC

53BEGIN { 53BEGIN {
54 $VERSION = 0.2; 54 $VERSION = 0.2;
55 55
56 @EXPORT = qw(aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink 56 @EXPORT = qw(aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink
57 aio_fsync aio_fdatasync aio_readahead); 57 aio_fsync aio_fdatasync aio_readahead);
58 @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel nreqs); 58 @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel max_outstanding nreqs);
59 59
60 require XSLoader; 60 require XSLoader;
61 XSLoader::load IO::AIO, $VERSION; 61 XSLoader::load IO::AIO, $VERSION;
62} 62}
63 63
65 65
66Set the minimum number of AIO threads to C<$nthreads>. The default is 66Set the minimum number of AIO threads to C<$nthreads>. The default is
67C<1>, which means a single asynchronous operation can be done at one time 67C<1>, which means a single asynchronous operation can be done at one time
68(the number of outstanding operations, however, is unlimited). 68(the number of outstanding operations, however, is unlimited).
69 69
70It is recommended to keep the number of threads low, as some linux 70It is recommended to keep the number of threads low, as some Linux
71kernel versions will scale negatively with the number of threads (higher 71kernel versions will scale negatively with the number of threads (higher
72parallelity => MUCH higher latency). 72parallelity => MUCH higher latency). With current Linux 2.6 versions, 4-32
73threads should be fine.
73 74
74Under normal circumstances you don't need to call this function, as this 75Under normal circumstances you don't need to call this function, as this
75module automatically starts a single async thread. 76module automatically starts some threads (the exact number might change,
77and is currently 4).
76 78
77=item IO::AIO::max_parallel $nthreads 79=item IO::AIO::max_parallel $nthreads
78 80
79Sets the maximum number of AIO threads to C<$nthreads>. If more than 81Sets the maximum number of AIO threads to C<$nthreads>. If more than
80the specified number of threads are currently running, kill them. This 82the specified number of threads are currently running, kill them. This
81function blocks until the limit is reached. 83function blocks until the limit is reached.
82 84
83This module automatically runs C<max_parallel 0> at program end, to ensure 85This module automatically runs C<max_parallel 0> at program end, to ensure
84that all threads are killed and that there are no outstanding requests. 86that all threads are killed and that there are no outstanding requests.
87
88Under normal circumstances you don't need to call this function.
89
90=item $oldnreqs = IO::AIO::max_outstanding $nreqs
91
92Sets the maximum number of outstanding requests to C<$nreqs>. If you
93try to queue up more than this number of requests, the caller will block until
94some requests have been handled.
95
96The default is very large, so normally there is no practical limit. If you
97queue up many requests in a loop it it often improves speed if you set
98this to a relatively low number, such as C<100>.
85 99
86Under normal circumstances you don't need to call this function. 100Under normal circumstances you don't need to call this function.
87 101
88=item $fileno = IO::AIO::poll_fileno 102=item $fileno = IO::AIO::poll_fileno
89 103

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines