ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.pod
(Generate patch)

Comparing libev/ev.pod (file contents):
Revision 1.192 by root, Tue Sep 30 19:51:44 2008 UTC vs.
Revision 1.195 by root, Mon Oct 20 17:50:48 2008 UTC

685C<EVUNLOOP_ONE>, which will make the innermost C<ev_loop> call return, or 685C<EVUNLOOP_ONE>, which will make the innermost C<ev_loop> call return, or
686C<EVUNLOOP_ALL>, which will make all nested C<ev_loop> calls return. 686C<EVUNLOOP_ALL>, which will make all nested C<ev_loop> calls return.
687 687
688This "unloop state" will be cleared when entering C<ev_loop> again. 688This "unloop state" will be cleared when entering C<ev_loop> again.
689 689
690It is safe to call C<ev_unloop> from otuside any C<ev_loop> calls.
691
690=item ev_ref (loop) 692=item ev_ref (loop)
691 693
692=item ev_unref (loop) 694=item ev_unref (loop)
693 695
694Ref/unref can be used to add or remove a reference count on the event 696Ref/unref can be used to add or remove a reference count on the event
967 969
968 ev_io_start (EV_DEFAULT_UC, &w); 970 ev_io_start (EV_DEFAULT_UC, &w);
969 971
970=item C<ev_TYPE_stop> (loop *, ev_TYPE *watcher) 972=item C<ev_TYPE_stop> (loop *, ev_TYPE *watcher)
971 973
972Stops the given watcher again (if active) and clears the pending 974Stops the given watcher if active, and clears the pending status (whether
975the watcher was active or not).
976
973status. It is possible that stopped watchers are pending (for example, 977It is possible that stopped watchers are pending - for example,
974non-repeating timers are being stopped when they become pending), but 978non-repeating timers are being stopped when they become pending - but
975C<ev_TYPE_stop> ensures that the watcher is neither active nor pending. If 979calling C<ev_TYPE_stop> ensures that the watcher is neither active nor
976you want to free or reuse the memory used by the watcher it is therefore a 980pending. If you want to free or reuse the memory used by the watcher it is
977good idea to always call its C<ev_TYPE_stop> function. 981therefore a good idea to always call its C<ev_TYPE_stop> function.
978 982
979=item bool ev_is_active (ev_TYPE *watcher) 983=item bool ev_is_active (ev_TYPE *watcher)
980 984
981Returns a true value iff the watcher is active (i.e. it has been started 985Returns a true value iff the watcher is active (i.e. it has been started
982and not yet been stopped). As long as a watcher is active you must not modify 986and not yet been stopped). As long as a watcher is active you must not modify
2513C<events> argument is being ignored. Otherwise, an C<ev_io> watcher for 2517C<events> argument is being ignored. Otherwise, an C<ev_io> watcher for
2514the given C<fd> and C<events> set will be created and started. 2518the given C<fd> and C<events> set will be created and started.
2515 2519
2516If C<timeout> is less than 0, then no timeout watcher will be 2520If C<timeout> is less than 0, then no timeout watcher will be
2517started. Otherwise an C<ev_timer> watcher with after = C<timeout> (and 2521started. Otherwise an C<ev_timer> watcher with after = C<timeout> (and
2518repeat = 0) will be started. While C<0> is a valid timeout, it is of 2522repeat = 0) will be started. C<0> is a valid timeout.
2519dubious value.
2520 2523
2521The callback has the type C<void (*cb)(int revents, void *arg)> and gets 2524The callback has the type C<void (*cb)(int revents, void *arg)> and gets
2522passed an C<revents> set like normal event callbacks (a combination of 2525passed an C<revents> set like normal event callbacks (a combination of
2523C<EV_ERROR>, C<EV_READ>, C<EV_WRITE> or C<EV_TIMEOUT>) and the C<arg> 2526C<EV_ERROR>, C<EV_READ>, C<EV_WRITE> or C<EV_TIMEOUT>) and the C<arg>
2524value passed to C<ev_once>: 2527value passed to C<ev_once>. Note that it is possible to receive I<both>
2528a timeout and an io event at the same time - you probably should give io
2529events precedence.
2530
2531Example: wait up to ten seconds for data to appear on STDIN_FILENO.
2525 2532
2526 static void stdin_ready (int revents, void *arg) 2533 static void stdin_ready (int revents, void *arg)
2527 { 2534 {
2535 if (revents & EV_READ)
2536 /* stdin might have data for us, joy! */;
2528 if (revents & EV_TIMEOUT) 2537 else if (revents & EV_TIMEOUT)
2529 /* doh, nothing entered */; 2538 /* doh, nothing entered */;
2530 else if (revents & EV_READ)
2531 /* stdin might have data for us, joy! */;
2532 } 2539 }
2533 2540
2534 ev_once (STDIN_FILENO, EV_READ, 10., stdin_ready, 0); 2541 ev_once (STDIN_FILENO, EV_READ, 10., stdin_ready, 0);
2535 2542
2536=item ev_feed_event (ev_loop *, watcher *, int revents) 2543=item ev_feed_event (ev_loop *, watcher *, int revents)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines