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

Comparing EV/EV.pm (file contents):
Revision 1.49 by root, Sat Nov 24 08:28:10 2007 UTC vs.
Revision 1.50 by root, Sat Nov 24 08:42:38 2007 UTC

233watchers with higher priority will be invoked first. The valid range of 233watchers with higher priority will be invoked first. The valid range of
234priorities lies between EV::MAXPRI (default 2) and EV::MINPRI (default 234priorities lies between EV::MAXPRI (default 2) and EV::MINPRI (default
235-2). If the priority is outside this range it will automatically be 235-2). If the priority is outside this range it will automatically be
236normalised to the nearest valid priority. 236normalised to the nearest valid priority.
237 237
238The default priority of any newly-created weatcher is 0. 238The default priority of any newly-created watcher is 0.
239
240Note that the priority semantics have not yet been fleshed out and are
241subject to almost certain change.
239 242
240=item $w->trigger ($revents) 243=item $w->trigger ($revents)
241 244
242Call the callback *now* with the given event mask. 245Call the callback *now* with the given event mask.
243 246
247=item $previous_state = $w->keepalive ($bool)
248
249Normally, C<EV::loop> will return when there are no active watchers
250(which is a "deadlock" because no progress can be made anymore). This is
251convinient because it allows you to start your watchers (and your jobs),
252call C<EV::loop> once and when it returns you know that all your jobs are
253finished (or they forgot to register some watchers for their task :).
254
255Sometimes, however, this gets in your way, for example when you the module
256that calls C<EV::loop> (usually the main program) is not the same module
257as a long-living watcher (for example a DNS client module written by
258somebody else even). Then you might want any outstanding requests to be
259handled, but you would not want to keep C<EV::loop> from returning just
260because you happen to have this long-running UDP port watcher.
261
262In this case you can clear the keepalive status, which means that even
263though your watcher is active, it won't keep C<EV::loop> from returning.
264
265The initial value for keepalive is true (enabled), and you cna change it
266any time.
267
268Example: Register an IO watcher for some UDP socket but do not keep the
269event loop from running just because of that watcher.
270
271 my $udp_socket = ...
272 my $udp_watcher = EV::io $udp_socket, EV::READ, sub { ... };
273 $udp_watcher->keepalive (0);
244 274
245=item $w = EV::io $fileno_or_fh, $eventmask, $callback 275=item $w = EV::io $fileno_or_fh, $eventmask, $callback
246 276
247=item $w = EV::io_ns $fileno_or_fh, $eventmask, $callback 277=item $w = EV::io_ns $fileno_or_fh, $eventmask, $callback
248 278

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines