ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/EV.pm
(Generate patch)

Comparing EV/EV.pm (file contents):
Revision 1.64 by root, Sat Dec 8 02:55:13 2007 UTC vs.
Revision 1.72 by root, Thu Dec 20 07:12:57 2007 UTC

68package EV; 68package EV;
69 69
70use strict; 70use strict;
71 71
72BEGIN { 72BEGIN {
73 our $VERSION = '1.8'; 73 our $VERSION = '2.0';
74 use XSLoader; 74 use XSLoader;
75 XSLoader::load "EV", $VERSION; 75 XSLoader::load "EV", $VERSION;
76} 76}
77 77
78@EV::IO::ISA = 78@EV::IO::ISA =
86@EV::Check::ISA = 86@EV::Check::ISA =
87@EV::Embed::ISA = 87@EV::Embed::ISA =
88@EV::Fork::ISA = 88@EV::Fork::ISA =
89 "EV::Watcher"; 89 "EV::Watcher";
90 90
91@EV::Loop::Default::ISA = "EV::Loop";
92
91=head1 BASIC INTERFACE 93=head1 BASIC INTERFACE
92 94
93=over 4 95=over 4
94 96
95=item $EV::DIED 97=item $EV::DIED
96 98
97Must contain a reference to a function that is called when a callback 99Must contain a reference to a function that is called when a callback
98throws an exception (with $@ containing thr error). The default prints an 100throws an exception (with $@ containing the error). The default prints an
99informative message and continues. 101informative message and continues.
100 102
101If this callback throws an exception it will be silently ignored. 103If this callback throws an exception it will be silently ignored.
102 104
103=item $time = EV::time 105=item $time = EV::time
160 162
161EV::once doesn't return anything: the watchers stay active till either 163EV::once doesn't return anything: the watchers stay active till either
162of them triggers, then they will be stopped and freed, and the callback 164of them triggers, then they will be stopped and freed, and the callback
163invoked. 165invoked.
164 166
167=item EV::feed_fd_event ($fd, $revents)
168
169Feed an event on a file descriptor into EV. EV will react to this call as
170if the readyness notifications specified by C<$revents> (a combination of
171C<EV::READ> and C<EV::WRITE>) happened on the file descriptor C<$fd>.
172
173=item EV::feed_signal_event ($signal)
174
175Feed a signal event into EV. EV will react to this call as if the signal
176specified by C<$signal> had occured.
177
165=back 178=back
179
166 180
167=head2 WATCHER OBJECTS 181=head2 WATCHER OBJECTS
168 182
169A watcher is an object that gets created to record your interest in some 183A watcher is an object that gets created to record your interest in some
170event. For instance, if you want to wait for STDIN to become readable, you 184event. For instance, if you want to wait for STDIN to become readable, you
253The default priority of any newly-created watcher is 0. 267The default priority of any newly-created watcher is 0.
254 268
255Note that the priority semantics have not yet been fleshed out and are 269Note that the priority semantics have not yet been fleshed out and are
256subject to almost certain change. 270subject to almost certain change.
257 271
258=item $w->trigger ($revents) 272=item $w->invoke ($revents)
259 273
260Call the callback *now* with the given event mask. 274Call the callback *now* with the given event mask.
275
276=item $w->feed_event ($revents)
277
278Feed some events on this watcher into EV. EV will react to this call as if
279the watcher had received the given C<$revents> mask.
280
281=item $revents = $w->clear_pending
282
283If the watcher is pending, this function returns clears its pending status
284and returns its C<$revents> bitset (as if its callback was invoked). If the
285watcher isn't pending it does nothing and returns C<0>.
261 286
262=item $previous_state = $w->keepalive ($bool) 287=item $previous_state = $w->keepalive ($bool)
263 288
264Normally, C<EV::loop> will return when there are no active watchers 289Normally, C<EV::loop> will return when there are no active watchers
265(which is a "deadlock" because no progress can be made anymore). This is 290(which is a "deadlock" because no progress can be made anymore). This is
471 496
472=item $w->again 497=item $w->again
473 498
474Simply stops and starts the watcher again. 499Simply stops and starts the watcher again.
475 500
501=item $time = $w->at
502
503Return the time that the watcher is expected to trigger next.
504
476=back 505=back
477 506
478 507
479=head3 SIGNAL WATCHERS - signal me when a signal gets signalled! 508=head3 SIGNAL WATCHERS - signal me when a signal gets signalled!
480 509
815our $DIED = sub { 844our $DIED = sub {
816 warn "EV: error in callback (ignoring): $@"; 845 warn "EV: error in callback (ignoring): $@";
817}; 846};
818 847
819default_loop 848default_loop
820 or die 'EV: cannot initialise libev backend. bad $ENV{LIBEV_METHODS}?'; 849 or die 'EV: cannot initialise libev backend. bad $ENV{LIBEV_FLAGS}?';
821 850
8221; 8511;
823 852
824=head1 SEE ALSO 853=head1 SEE ALSO
825 854

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines