… | |
… | |
26 | }; |
26 | }; |
27 | |
27 | |
28 | # called when event loop idle (if applicable) |
28 | # called when event loop idle (if applicable) |
29 | my $w = AE::idle sub { ... }; |
29 | my $w = AE::idle sub { ... }; |
30 | |
30 | |
31 | my $w = AE::cv; # stores whether a condition was flagged |
31 | my $cv = AE::cv; # stores whether a condition was flagged |
32 | $w->send; # wake up current and all future recv's |
32 | $cv->send; # wake up current and all future recv's |
33 | $w->recv; # enters "main loop" till $condvar gets ->send |
33 | $cv->recv; # enters "main loop" till $condvar gets ->send |
34 | # use a condvar in callback mode: |
34 | # use a condvar in callback mode: |
35 | $w->cb (sub { $_[0]->recv }); |
35 | $cv->cb (sub { $_[0]->recv }); |
36 | |
36 | |
37 | |
37 | |
38 | =head1 DESCRIPTION |
38 | =head1 DESCRIPTION |
39 | |
39 | |
40 | This module documents the new simpler AnyEvent API. |
40 | This module documents the new simpler AnyEvent API. |
… | |
… | |
53 | |
53 | |
54 | Also, some backends (Perl and EV) are so fast that the method call |
54 | Also, some backends (Perl and EV) are so fast that the method call |
55 | overhead is very noticeable (with EV it increases the execution time five- |
55 | overhead is very noticeable (with EV it increases the execution time five- |
56 | to six-fold, with Perl the method call overhead is about a factor of two). |
56 | to six-fold, with Perl the method call overhead is about a factor of two). |
57 | |
57 | |
58 | At the moment, there is no checking (L<AnyEvent::Strict> does not |
|
|
59 | affect this API), so the L<AnyEvent> API still has a definite advantage |
|
|
60 | here. |
|
|
61 | |
|
|
62 | Note that the C<AE> API is an alternative to, not the future version of, |
58 | Note that the C<AE> API is an alternative to, not the future version of, |
63 | the AnyEvent API. Both APIs can be used interchangeably and and there are |
59 | the AnyEvent API. Both APIs can be used interchangeably and there are |
64 | no plans to "switch", so if in doubt, feel free to use the L<AnyEvent> |
60 | no plans to "switch", so if in doubt, feel free to use the L<AnyEvent> |
65 | API in new code. |
61 | API in new code. |
66 | |
62 | |
67 | As the AE API is complementary, not everything in the AnyEvent API is |
63 | As the AE API is complementary, not everything in the AnyEvent API is |
68 | available, and you still need to use AnyEvent for the finer stuff. Also, |
64 | available, and you still need to use AnyEvent for the finer stuff. Also, |
69 | you should not C<use AE> directly, C<use AnyEvent> will provide the AE |
65 | you should not C<use AE> directly, C<use AnyEvent> will provide the AE |
70 | namespace. |
66 | namespace. |
71 | |
67 | |
|
|
68 | At the moment, these functions will become slower then their method-call |
|
|
69 | counterparts when using L<AnyEvent::Strict> or L<AnyEvent::Debug>::wrap. |
|
|
70 | |
72 | =head2 FUNCTIONS |
71 | =head2 FUNCTIONS |
73 | |
72 | |
74 | This section briefly describes the alternative watcher |
73 | This section briefly describes the alternative watcher constructors and |
75 | constructors. Semantics are not described here; please |
74 | other functions available inside the C<AE> namespace. Semantics are not |
|
|
75 | described here; please refer to the description of the function or method |
76 | refer to the L<AnyEvent> manpage for the details. |
76 | with the same name in the L<AnyEvent> manpage for the details. |
77 | |
77 | |
78 | =over 4 |
78 | =over 4 |
79 | |
79 | |
80 | =cut |
80 | =cut |
81 | |
81 | |
… | |
… | |
168 | =back |
168 | =back |
169 | |
169 | |
170 | =head1 AUTHOR |
170 | =head1 AUTHOR |
171 | |
171 | |
172 | Marc Lehmann <schmorp@schmorp.de> |
172 | Marc Lehmann <schmorp@schmorp.de> |
173 | http://home.schmorp.de/ |
173 | http://anyevent.schmorp.de |
174 | |
174 | |
175 | =cut |
175 | =cut |
176 | |
176 | |
177 | 1 |
177 | 1 |
178 | |
178 | |