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.2 by root, Tue Aug 14 18:06:37 2001 UTC vs.
Revision 1.3 by root, Tue Aug 14 23:25:39 2001 UTC

5=head1 SYNOPSIS 5=head1 SYNOPSIS
6 6
7 use Linux::AIO; 7 use Linux::AIO;
8 8
9=head1 DESCRIPTION 9=head1 DESCRIPTION
10
11This module implements asynchroneous i/o using the means available to
12linux - clone. It does not hook into the POSIX aio_* functions because
13linux does not yet support these in the kernel. Instead, a number of
14threads are started that execute your read/writes and signal their
15completion.
10 16
11=over 4 17=over 4
12 18
13=cut 19=cut
14 20
26 XSLoader::load Linux::AIO, $VERSION; 32 XSLoader::load Linux::AIO, $VERSION;
27} 33}
28 34
29=item Linux::AIO::min_parallel($nthreads) 35=item Linux::AIO::min_parallel($nthreads)
30 36
31Set the minimum number of AIO threads to $nthreads. 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
39will be started and you aio-operations will seem to hang.
32 40
33=cut 41=cut
34 42
35=item aio_read($fh,$offset,$length, $data,$dataoffset,$callback) 43=item aio_read($fh,$offset,$length, $data,$dataoffset,$callback)
36aio_write($fh,$offset,$length, $data,$dataoffset,$callback) 44aio_write($fh,$offset,$length, $data,$dataoffset,$callback)
47=item Linux::AIO::poll_cb 55=item Linux::AIO::poll_cb
48 56
49Process all outstanding events on the result pipe. You have to call this 57Process all outstanding events on the result pipe. You have to call this
50regularly. Returns the number of events processed. 58regularly. Returns the number of events processed.
51 59
60You can use Event to multiplex, e.g.:
61
62 Event->io(fd => Linux::AIO::poll_fileno,
63 poll => 'r', async => 1,
64 cb => \&Linux::AIO::poll_cb );
65
66
52=item Linux::AIO::nreqs 67=item Linux::AIO::nreqs
53 68
54Returns the number of requests currently outstanding. 69Returns the number of requests currently outstanding.
55 70
56=cut 71=cut
65 80
66=head1 BUGS 81=head1 BUGS
67 82
68This module has not yet been extensively tested. Watch out! 83This module has not yet been extensively tested. Watch out!
69 84
70This module does not use the aio_* posix functions because a) linux does
71not have aio, b) the existing aio_* functions use pthreads, which are too
72buggy for my usage.
73
74=head1 SEE ALSO 85=head1 SEE ALSO
75 86
76L<Coro>. 87L<Coro>.
77 88
78=head1 AUTHOR 89=head1 AUTHOR

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines