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

Comparing libev/ev.pod (file contents):
Revision 1.398 by root, Mon Apr 2 18:39:54 2012 UTC vs.
Revision 1.399 by root, Mon Apr 2 23:14:41 2012 UTC

792without a previous call to C<ev_suspend>. 792without a previous call to C<ev_suspend>.
793 793
794Calling C<ev_suspend>/C<ev_resume> has the side effect of updating the 794Calling C<ev_suspend>/C<ev_resume> has the side effect of updating the
795event loop time (see C<ev_now_update>). 795event loop time (see C<ev_now_update>).
796 796
797=item ev_run (loop, int flags) 797=item bool ev_run (loop, int flags)
798 798
799Finally, this is it, the event handler. This function usually is called 799Finally, this is it, the event handler. This function usually is called
800after you have initialised all your watchers and you want to start 800after you have initialised all your watchers and you want to start
801handling events. It will ask the operating system for any new events, call 801handling events. It will ask the operating system for any new events, call
802the watcher callbacks, an then repeat the whole process indefinitely: This 802the watcher callbacks, and then repeat the whole process indefinitely: This
803is why event loops are called I<loops>. 803is why event loops are called I<loops>.
804 804
805If the flags argument is specified as C<0>, it will keep handling events 805If the flags argument is specified as C<0>, it will keep handling events
806until either no event watchers are active anymore or C<ev_break> was 806until either no event watchers are active anymore or C<ev_break> was
807called. 807called.
808
809The return value is false if there are no more active watchers (which
810usually means "all jobs done" or "deadlock"), and true in all other cases
811(which usually means " you should call C<ev_run> again").
808 812
809Please note that an explicit C<ev_break> is usually better than 813Please note that an explicit C<ev_break> is usually better than
810relying on all watchers to be stopped when deciding when a program has 814relying on all watchers to be stopped when deciding when a program has
811finished (especially in interactive programs), but having a program 815finished (especially in interactive programs), but having a program
812that automatically loops as long as it has to and no longer by virtue 816that automatically loops as long as it has to and no longer by virtue
813of relying on its watchers stopping correctly, that is truly a thing of 817of relying on its watchers stopping correctly, that is truly a thing of
814beauty. 818beauty.
815 819
816This function is also I<mostly> exception-safe - you can break out of 820This function is I<mostly> exception-safe - you can break out of a
817a C<ev_run> call by calling C<longjmp> in a callback, throwing a C++ 821C<ev_run> call by calling C<longjmp> in a callback, throwing a C++
818exception and so on. This does not decrement the C<ev_depth> value, nor 822exception and so on. This does not decrement the C<ev_depth> value, nor
819will it clear any outstanding C<EVBREAK_ONE> breaks. 823will it clear any outstanding C<EVBREAK_ONE> breaks.
820 824
821A flags value of C<EVRUN_NOWAIT> will look for new events, will handle 825A flags value of C<EVRUN_NOWAIT> will look for new events, will handle
822those events and any already outstanding ones, but will not wait and 826those events and any already outstanding ones, but will not wait and

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines