line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
AnyEvent::Impl::EV - AnyEvent adaptor for EV |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use AnyEvent; |
8
|
|
|
|
|
|
|
use EV; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# this module gets loaded automatically as required |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
This module provides transparent support for AnyEvent. You don't have to |
15
|
|
|
|
|
|
|
do anything to make EV work with AnyEvent except by loading EV before |
16
|
|
|
|
|
|
|
creating the first AnyEvent watcher. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
EV is the fastest event library for perl, and best supported by |
19
|
|
|
|
|
|
|
AnyEvent. Most functions from the L API are implemented as direct |
20
|
|
|
|
|
|
|
aliases to EV functions, so using EV via AE is as fast as using EV |
21
|
|
|
|
|
|
|
directly. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
package AnyEvent::Impl::EV; |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
3
|
|
19
|
use AnyEvent (); BEGIN { AnyEvent::common_sense } |
|
3
|
|
|
3
|
|
6
|
|
|
3
|
|
|
|
|
67
|
|
|
3
|
|
|
|
|
12
|
|
28
|
3
|
|
|
3
|
|
15
|
use EV 4.00; |
|
3
|
|
|
|
|
51
|
|
|
3
|
|
|
|
|
1402
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
*AE::time = \&EV::time; |
31
|
|
|
|
|
|
|
*AE::now = \&EV::now; |
32
|
|
|
|
|
|
|
*AE::now_update = \&EV::now_update; |
33
|
|
|
|
|
|
|
*AE::timer = \&EV::timer; |
34
|
|
|
|
|
|
|
*AE::signal = \&EV::signal; |
35
|
|
|
|
|
|
|
*AE::idle = \&EV::idle; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# cannot override directly, as EV doesn't allow arguments |
38
|
0
|
|
|
0
|
0
|
0
|
sub time { EV::time } |
39
|
0
|
|
|
0
|
0
|
0
|
sub now { EV::now } |
40
|
0
|
|
|
0
|
0
|
0
|
sub now_update { EV::now_update } |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
*AE::io = defined &EV::_ae_io # 3.8+, but keep just in case it is dropped |
43
|
|
|
|
|
|
|
? \&EV::_ae_io |
44
|
|
|
|
|
|
|
: sub($$$) { EV::io $_[0], $_[1] ? EV::WRITE : EV::READ, $_[2] }; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub timer { |
47
|
0
|
|
|
0
|
0
|
0
|
my ($class, %arg) = @_; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
EV::timer $arg{after}, $arg{interval}, $arg{cb} |
50
|
0
|
|
|
|
|
0
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub io { |
53
|
0
|
|
|
0
|
0
|
0
|
my ($class, %arg) = @_; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
EV::io |
56
|
|
|
|
|
|
|
$arg{fh}, |
57
|
|
|
|
|
|
|
$arg{poll} eq "r" ? EV::READ : EV::WRITE, |
58
|
|
|
|
|
|
|
$arg{cb} |
59
|
0
|
0
|
|
|
|
0
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub signal { |
62
|
0
|
|
|
0
|
0
|
0
|
my ($class, %arg) = @_; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
EV::signal $arg{signal}, $arg{cb} |
65
|
0
|
|
|
|
|
0
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub child { |
68
|
0
|
|
|
0
|
0
|
0
|
my ($class, %arg) = @_; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
0
|
my $cb = $arg{cb}; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
EV::child $arg{pid}, 0, sub { |
73
|
0
|
|
|
0
|
|
0
|
$cb->($_[0]->rpid, $_[0]->rstatus); |
74
|
|
|
|
|
|
|
} |
75
|
0
|
|
|
|
|
0
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub idle { |
78
|
0
|
|
|
0
|
0
|
0
|
my ($class, %arg) = @_; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
EV::idle $arg{cb} |
81
|
0
|
|
|
|
|
0
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub _poll { |
84
|
0
|
|
|
0
|
|
0
|
EV::run EV::RUN_ONCE; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub AnyEvent::CondVar::Base::_wait { |
88
|
9
|
|
|
9
|
|
98120
|
EV::run EV::RUN_ONCE until exists $_[0]{_ae_sent}; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
#sub loop { |
92
|
|
|
|
|
|
|
# EV::run; |
93
|
|
|
|
|
|
|
#} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 SEE ALSO |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L, L. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Marc Lehmann |
102
|
|
|
|
|
|
|
http://anyevent.schmorp.de |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1 |
107
|
|
|
|
|
|
|
|