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

Comparing EV/README (file contents):
Revision 1.23 by root, Sat Mar 8 16:00:07 2008 UTC vs.
Revision 1.27 by root, Mon May 26 05:37:18 2008 UTC

54 54
55DESCRIPTION 55DESCRIPTION
56 This module provides an interface to libev 56 This module provides an interface to libev
57 (<http://software.schmorp.de/pkg/libev.html>). While the documentation 57 (<http://software.schmorp.de/pkg/libev.html>). While the documentation
58 below is comprehensive, one might also consult the documentation of 58 below is comprehensive, one might also consult the documentation of
59 libev itself (<http://cvs.schmorp.de/libev/ev.html>) for more subtle 59 libev itself (<http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod>)
60 details on watcher semantics or some discussion on the available 60 for more subtle details on watcher semantics or some discussion on the
61 backends, or how to force a specific backend with "LIBEV_FLAGS", or just 61 available backends, or how to force a specific backend with
62 about in any case because it has much more detailed information. 62 "LIBEV_FLAGS", or just about in any case because it has much more
63 detailed information.
64
65 This module is very fast and scalable. It is actually so fast that you
66 can use it through the AnyEvent module, stay portable to other event
67 loops (if you don't rely on any watcher types not available through it)
68 and still be faster than with any other event loop currently supported
69 in Perl.
63 70
64EVENT LOOPS 71EVENT LOOPS
65 EV supports multiple event loops: There is a single "default event loop" 72 EV supports multiple event loops: There is a single "default event loop"
66 that can handle everything including signals and child watchers, and any 73 that can handle everything including signals and child watchers, and any
67 number of "dynamic event loops" that can use different backends (with 74 number of "dynamic event loops" that can use different backends (with
89 loop is protected by this module. 96 loop is protected by this module.
90 97
91 $loop->loop_fork 98 $loop->loop_fork
92 Must be called after a fork in the child, before entering or 99 Must be called after a fork in the child, before entering or
93 continuing the event loop. An alternative is to use 100 continuing the event loop. An alternative is to use
94 "EV::FLAG_FORKCHECK" which calls this fucntion automatically, at 101 "EV::FLAG_FORKCHECK" which calls this function automatically, at
95 some performance loss (refer to the libev documentation). 102 some performance loss (refer to the libev documentation).
96 103
104 $loop->loop_verify
105 Calls "ev_verify" to make internal consistency checks (for debugging
106 libev) and abort the program if any data structures wree found to be
107 corrupted.
108
97 $loop = EV::default_loop [$flags] 109 $loop = EV::default_loop [$flags]
98 Return the default loop (which is a singleton object). 110 Return the default loop (which is a singleton object). Since this
111 module already creates the default loop with default flags,
112 specifying flags here will not have any effect unless you destroy
113 the default loop.
99 114
100BASIC INTERFACE 115BASIC INTERFACE
101 $EV::DIED 116 $EV::DIED
102 Must contain a reference to a function that is called when a 117 Must contain a reference to a function that is called when a
103 callback throws an exception (with $@ containing the error). The 118 callback throws an exception (with $@ containing the error). The
449 each time the periodic watcher gets scheduled, the reschedule 464 each time the periodic watcher gets scheduled, the reschedule
450 callback ($reschedule_cb) will be called with the watcher as 465 callback ($reschedule_cb) will be called with the watcher as
451 first, and the current time as second argument. 466 first, and the current time as second argument.
452 467
453 *This callback MUST NOT stop or destroy this or any other 468 *This callback MUST NOT stop or destroy this or any other
469 periodic watcher, ever, and MUST NOT call any event loop
454 periodic watcher, ever*. If you need to stop it, return 1e30 and 470 functions or methods*. If you need to stop it, return 1e30 and
455 stop it afterwards. 471 stop it afterwards. You may create and start a "EV::prepare"
472 watcher for this task.
456 473
457 It must return the next time to trigger, based on the passed 474 It must return the next time to trigger, based on the passed
458 time value (that is, the lowest time value larger than to the 475 time value (that is, the lowest time value larger than or equal
459 second argument). It will usually be called just before the 476 to to the second argument). It will usually be called just
460 callback will be triggered, but might be called at other times, 477 before the callback will be triggered, but might be called at
461 too. 478 other times, too.
462 479
463 This can be used to create very complex timers, such as a timer 480 This can be used to create very complex timers, such as a timer
464 that triggers on each midnight, local time (actually 24 hours 481 that triggers on each midnight, local time (actually 24 hours
465 after the last midnight, to keep the example simple. If you know 482 after the last midnight, to keep the example simple. If you know
466 a way to do it correctly in about the same space (without 483 a way to do it correctly in about the same space (without
785 802
786 It is, however, possible to use them from the XS level. 803 It is, however, possible to use them from the XS level.
787 804
788 Please see the libev documentation for further details. 805 Please see the libev documentation for further details.
789 806
807 $w = EV::async $callback
808 $w = EV::async_ns $callback
809 $w->send
810 $bool = $w->async_pending
811
790PERL SIGNALS 812PERL SIGNALS
791 While Perl signal handling (%SIG) is not affected by EV, the behaviour 813 While Perl signal handling (%SIG) is not affected by EV, the behaviour
792 with EV is as the same as any other C library: Perl-signals will only be 814 with EV is as the same as any other C library: Perl-signals will only be
793 handled when Perl runs, which means your signal handler might be invoked 815 handled when Perl runs, which means your signal handler might be invoked
794 only the next time an event callback is invoked. 816 only the next time an event callback is invoked.
828 course. 850 course.
829 851
830SEE ALSO 852SEE ALSO
831 EV::ADNS (asynchronous DNS), Glib::EV (makes Glib/Gtk2 use EV as event 853 EV::ADNS (asynchronous DNS), Glib::EV (makes Glib/Gtk2 use EV as event
832 loop), EV::Glib (embed Glib into EV), Coro::EV (efficient coroutines 854 loop), EV::Glib (embed Glib into EV), Coro::EV (efficient coroutines
833 with EV), Net::SNMP::EV (asynchronous SNMP). 855 with EV), Net::SNMP::EV (asynchronous SNMP), AnyEvent for event-loop
856 agnostic and portable event driven programming.
834 857
835AUTHOR 858AUTHOR
836 Marc Lehmann <schmorp@schmorp.de> 859 Marc Lehmann <schmorp@schmorp.de>
837 http://home.schmorp.de/ 860 http://home.schmorp.de/
838 861

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines