… | |
… | |
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. |
… | |
… | |
68 | At the moment, these functions will become slower then their method-call |
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. |
69 | counterparts when using L<AnyEvent::Strict> or L<AnyEvent::Debug>::wrap. |
70 | |
70 | |
71 | =head2 FUNCTIONS |
71 | =head2 FUNCTIONS |
72 | |
72 | |
73 | This section briefly describes the alternative watcher |
73 | This section briefly describes the alternative watcher constructors and |
74 | 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 |
75 | refer to the L<AnyEvent> manpage for the details. |
76 | with the same name in the L<AnyEvent> manpage for the details. |
76 | |
77 | |
77 | =over 4 |
78 | =over 4 |
78 | |
79 | |
79 | =cut |
80 | =cut |
80 | |
81 | |
… | |
… | |
90 | false) or write events (C<$watch_write> is true) on the file handle or |
91 | false) or write events (C<$watch_write> is true) on the file handle or |
91 | file descriptor C<$fh_or_fd>. |
92 | file descriptor C<$fh_or_fd>. |
92 | |
93 | |
93 | The callback C<$cb> is invoked as soon and as long as I/O of the type |
94 | The callback C<$cb> is invoked as soon and as long as I/O of the type |
94 | specified by C<$watch_write>) can be done on the file handle/descriptor. |
95 | specified by C<$watch_write>) can be done on the file handle/descriptor. |
|
|
96 | |
|
|
97 | If you want a mnemomic for the second argument: C<0> is standard I<input>, |
|
|
98 | for I<reading>, and C<1> is standard I<output>, for I<writing>. |
95 | |
99 | |
96 | Example: wait until STDIN becomes readable. |
100 | Example: wait until STDIN becomes readable. |
97 | |
101 | |
98 | $stdin_ready = AE::io *STDIN, 0, sub { scalar <STDIN> }; |
102 | $stdin_ready = AE::io *STDIN, 0, sub { scalar <STDIN> }; |
99 | |
103 | |
… | |
… | |
167 | =back |
171 | =back |
168 | |
172 | |
169 | =head1 AUTHOR |
173 | =head1 AUTHOR |
170 | |
174 | |
171 | Marc Lehmann <schmorp@schmorp.de> |
175 | Marc Lehmann <schmorp@schmorp.de> |
172 | http://home.schmorp.de/ |
176 | http://anyevent.schmorp.de |
173 | |
177 | |
174 | =cut |
178 | =cut |
175 | |
179 | |
176 | 1 |
180 | 1 |
177 | |
181 | |