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.194 by root, Mon Oct 20 16:08:36 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
2513C<events> argument is being ignored. Otherwise, an C<ev_io> watcher for 2515C<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. 2516the given C<fd> and C<events> set will be created and started.
2515 2517
2516If C<timeout> is less than 0, then no timeout watcher will be 2518If C<timeout> is less than 0, then no timeout watcher will be
2517started. Otherwise an C<ev_timer> watcher with after = C<timeout> (and 2519started. 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 2520repeat = 0) will be started. C<0> is a valid timeout.
2519dubious value.
2520 2521
2521The callback has the type C<void (*cb)(int revents, void *arg)> and gets 2522The 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 2523passed 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> 2524C<EV_ERROR>, C<EV_READ>, C<EV_WRITE> or C<EV_TIMEOUT>) and the C<arg>
2524value passed to C<ev_once>: 2525value passed to C<ev_once>. Note that it is possible to receive I<both>
2526a timeout and an io event at the same time - you probably should give io
2527events precedence.
2528
2529Example: wait up to ten seconds for data to appear on STDIN_FILENO.
2525 2530
2526 static void stdin_ready (int revents, void *arg) 2531 static void stdin_ready (int revents, void *arg)
2527 { 2532 {
2533 if (revents & EV_READ)
2534 /* stdin might have data for us, joy! */;
2528 if (revents & EV_TIMEOUT) 2535 else if (revents & EV_TIMEOUT)
2529 /* doh, nothing entered */; 2536 /* doh, nothing entered */;
2530 else if (revents & EV_READ)
2531 /* stdin might have data for us, joy! */;
2532 } 2537 }
2533 2538
2534 ev_once (STDIN_FILENO, EV_READ, 10., stdin_ready, 0); 2539 ev_once (STDIN_FILENO, EV_READ, 10., stdin_ready, 0);
2535 2540
2536=item ev_feed_event (ev_loop *, watcher *, int revents) 2541=item ev_feed_event (ev_loop *, watcher *, int revents)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines