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

Comparing EV/README (file contents):
Revision 1.36 by root, Thu Oct 21 02:46:59 2010 UTC vs.
Revision 1.39 by root, Tue Jan 11 13:45:28 2011 UTC

75 can use it through the AnyEvent module, stay portable to other event 75 can use it through the AnyEvent module, stay portable to other event
76 loops (if you don't rely on any watcher types not available through it) 76 loops (if you don't rely on any watcher types not available through it)
77 and still be faster than with any other event loop currently supported 77 and still be faster than with any other event loop currently supported
78 in Perl. 78 in Perl.
79 79
80 PORTING FROM EV 3.X to 4.X
81 EV version 4 introduces a number of incompatible changes summarised
82 here. According to the depreciation strategy used by libev, there is a
83 compatibility layer in place so programs should continue to run
84 unchanged (the XS interface lacks this layer, so programs using that one
85 need to be updated).
86
87 This compatibility layer will be switched off in some future release.
88
89 All changes relevant to Perl are renames of symbols, functions and
90 methods:
91
92 EV::loop => EV::run
93 EV::LOOP_NONBLOCK => EV::RUN_NOWAIT
94 EV::LOOP_ONESHOT => EV::RUN_ONCE
95
96 EV::unloop => EV::break
97 EV::UNLOOP_CANCEL => EV::BREAK_CANCEL
98 EV::UNLOOP_ONE => EV::BREAK_ONE
99 EV::UNLOOP_ALL => EV::BREAK_ALL
100
101 EV::TIMEOUT => EV::TIMER
102
103 EV::loop_count => EV::iteration
104 EV::loop_depth => EV::depth
105 EV::loop_verify => EV::verify
106
107 The loop object methods corresponding to the functions above have been
108 similarly renamed.
109
80 MODULE EXPORTS 110 MODULE EXPORTS
81 This module does not export any symbols. 111 This module does not export any symbols.
82 112
83EVENT LOOPS 113EVENT LOOPS
84 EV supports multiple event loops: There is a single "default event loop" 114 EV supports multiple event loops: There is a single "default event loop"
210 Begin checking for events and calling callbacks. It returns when a 240 Begin checking for events and calling callbacks. It returns when a
211 callback calls EV::unloop. 241 callback calls EV::unloop.
212 242
213 The $flags argument can be one of the following: 243 The $flags argument can be one of the following:
214 244
215 0 as above 245 0 as above
216 EV::LOOP_ONESHOT block at most once (wait, but do not loop) 246 EV::LOOP_ONCE block at most once (wait, but do not loop)
217 EV::LOOP_NONBLOCK do not block at all (fetch/handle events but do not wait) 247 EV::LOOP_NOWAIT do not block at all (fetch/handle events but do not wait)
218 248
219 EV::unloop [$how] 249 EV::break [$how]
220 $loop->unloop ([$how]) 250 $loop->break ([$how])
221 When called with no arguments or an argument of EV::UNLOOP_ONE, 251 When called with no arguments or an argument of EV::BREAK_ONE, makes
222 makes the innermost call to EV::loop return. 252 the innermost call to EV::loop return.
223 253
224 When called with an argument of EV::UNLOOP_ALL, all calls to 254 When called with an argument of EV::BREAK_ALL, all calls to EV::loop
225 EV::loop will return as fast as possible. 255 will return as fast as possible.
256
257 When called with an argument of EV::BREAK_CANCEL, any pending break
258 will be cancelled.
226 259
227 $count = EV::loop_count 260 $count = EV::loop_count
228 $count = $loop->loop_count 261 $count = $loop->loop_count
229 Return the number of times the event loop has polled for new events. 262 Return the number of times the event loop has polled for new events.
230 Sometimes useful as a generation counter. 263 Sometimes useful as a generation counter.
250 283
251 EV::once doesn't return anything: the watchers stay active till 284 EV::once doesn't return anything: the watchers stay active till
252 either of them triggers, then they will be stopped and freed, and 285 either of them triggers, then they will be stopped and freed, and
253 the callback invoked. 286 the callback invoked.
254 287
255 EV::feed_fd_event ($fd, $revents) 288 EV::feed_fd_event $fd, $revents
256 $loop->feed_fd_event ($fd, $revents) 289 $loop->feed_fd_event ($fd, $revents)
257 Feed an event on a file descriptor into EV. EV will react to this 290 Feed an event on a file descriptor into EV. EV will react to this
258 call as if the readyness notifications specified by $revents (a 291 call as if the readyness notifications specified by $revents (a
259 combination of "EV::READ" and "EV::WRITE") happened on the file 292 combination of "EV::READ" and "EV::WRITE") happened on the file
260 descriptor $fd. 293 descriptor $fd.
261 294
262 EV::feed_signal_event ($signal) 295 EV::feed_signal_event $signal
263 Feed a signal event into EV. EV will react to this call as if the 296 Feed a signal event into the default loop. EV will react to this
264 signal specified by $signal had occured. 297 call as if the signal specified by $signal had occured.
298
299 EV::feed_signal $signal
300 Feed a signal event into EV - unlike "EV::feed_signal_event", this
301 works regardless of which loop has registered the signal, and is
302 mainly useful fro custom signal implementations.
265 303
266 EV::set_io_collect_interval $time 304 EV::set_io_collect_interval $time
267 $loop->set_io_collect_interval ($time) 305 $loop->set_io_collect_interval ($time)
268 EV::set_timeout_collect_interval $time 306 EV::set_timeout_collect_interval $time
269 $loop->set_timeout_collect_interval ($time) 307 $loop->set_timeout_collect_interval ($time)
766 $w = $loop->check_ns ($callback) 804 $w = $loop->check_ns ($callback)
767 Call the callback just after the process wakes up again (after it 805 Call the callback just after the process wakes up again (after it
768 has gathered events), but before any other callbacks have been 806 has gathered events), but before any other callbacks have been
769 invoked. 807 invoked.
770 808
771 This is used to integrate other event-based software into the EV 809 This can be used to integrate other event-based software into the EV
772 mainloop: You register a prepare callback and in there, you create 810 mainloop: You register a prepare callback and in there, you create
773 io and timer watchers as required by the other software. Here is a 811 io and timer watchers as required by the other software. Here is a
774 real-world example of integrating Net::SNMP (with some details left 812 real-world example of integrating Net::SNMP (with some details left
775 out): 813 out):
776 814
812 watchers are destroyed before this can happen (remember EV::check 850 watchers are destroyed before this can happen (remember EV::check
813 gets called first). 851 gets called first).
814 852
815 The "check_ns" variant doesn't start (activate) the newly created 853 The "check_ns" variant doesn't start (activate) the newly created
816 watcher. 854 watcher.
855
856 EV::CHECK constant issues
857 Like all other watcher types, there is a bitmask constant for use in
858 $revents and other places. The "EV::CHECK" is special as it has the
859 same name as the "CHECK" sub called by Perl. This doesn't cause big
860 issues on newer perls (beginning with 5.8.9), but it means thatthe
861 constant must be *inlined*, i.e. runtime calls will not work. That
862 means that as long as you always "use EV" and then "EV::CHECK" you
863 are on the safe side.
817 864
818 FORK WATCHERS - the audacity to resume the event loop after a fork 865 FORK WATCHERS - the audacity to resume the event loop after a fork
819 Fork watchers are called when a "fork ()" was detected. The invocation 866 Fork watchers are called when a "fork ()" was detected. The invocation
820 is done before the event loop blocks next and before "check" watchers 867 is done before the event loop blocks next and before "check" watchers
821 are being called, and only in the child after the fork. 868 are being called, and only in the child after the fork.
923 970
924 On win32, there is no notion of fork so all this doesn't apply, of 971 On win32, there is no notion of fork so all this doesn't apply, of
925 course. 972 course.
926 973
927SEE ALSO 974SEE ALSO
928 EV::ADNS (asynchronous DNS), Glib::EV (makes Glib/Gtk2 use EV as event 975 EV::MakeMaker - MakeMaker interface to XS API, EV::ADNS (asynchronous
929 loop), EV::Glib (embed Glib into EV), Coro::EV (efficient coroutines 976 DNS), Glib::EV (makes Glib/Gtk2 use EV as event loop), EV::Glib (embed
930 with EV), Net::SNMP::EV (asynchronous SNMP), AnyEvent for event-loop 977 Glib into EV), Coro::EV (efficient thread integration), Net::SNMP::EV
931 agnostic and portable event driven programming. 978 (asynchronous SNMP), AnyEvent for event-loop agnostic and portable event
979 driven programming.
932 980
933AUTHOR 981AUTHOR
934 Marc Lehmann <schmorp@schmorp.de> 982 Marc Lehmann <schmorp@schmorp.de>
935 http://home.schmorp.de/ 983 http://home.schmorp.de/
936 984

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines