line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
AnyEvent::AIO - truly asynchronous file and directory I/O |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use AnyEvent::AIO; |
8
|
|
|
|
|
|
|
use IO::AIO; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# can now use any of the aio requests your IO::AIO module supports |
11
|
|
|
|
|
|
|
# as long as you use an event loop supported by AnyEvent. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
This module is an L user, you need to make sure that you use and |
16
|
|
|
|
|
|
|
run a supported event loop. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Loading this module will install the necessary magic to seamlessly |
19
|
|
|
|
|
|
|
integrate L into L, i.e. you no longer need to concern |
20
|
|
|
|
|
|
|
yourself with calling C or any of that stuff (you still |
21
|
|
|
|
|
|
|
can, but this module will do it in case you don't). |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
The AnyEvent watcher can be disabled by executing C
|
24
|
|
|
|
|
|
|
$AnyEvent::AIO::WATCHER>. Please notify the author of when and why you |
25
|
|
|
|
|
|
|
think this was necessary. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
package AnyEvent::AIO; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
616
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
32
|
1
|
|
|
1
|
|
4
|
no warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
1
|
|
1555
|
use AnyEvent (); |
|
1
|
|
|
|
|
6401
|
|
|
1
|
|
|
|
|
22
|
|
35
|
1
|
|
|
1
|
|
1225
|
use IO::AIO (); |
|
1
|
|
|
|
|
9415
|
|
|
1
|
|
|
|
|
34
|
|
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
|
12
|
use base Exporter::; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
219
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
our $VERSION = '1.1'; |
40
|
|
|
|
|
|
|
our $WATCHER; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $guard = AnyEvent::post_detect { |
43
|
|
|
|
|
|
|
$WATCHER = AnyEvent->io (fh => IO::AIO::poll_fileno, poll => 'r', cb => \&IO::AIO::poll_cb); |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
$WATCHER ||= $guard; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
IO::AIO::_on_next_submit \&AnyEvent::detect; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SEE ALSO |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
L, L (for a more natural syntax). |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 AUTHOR |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Marc Lehmann |
56
|
|
|
|
|
|
|
http://home.schmorp.de/ |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1 |