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

Comparing Coro/EV/EV.pm (file contents):
Revision 1.4 by root, Thu Nov 1 07:04:20 2007 UTC vs.
Revision 1.5 by root, Thu Nov 1 08:28:58 2007 UTC

4 4
5=head1 SYNOPSIS 5=head1 SYNOPSIS
6 6
7 use Coro; 7 use Coro;
8 use Coro::EV; 8 use Coro::EV;
9
10 EV::loop;
9 11
10=head1 DESCRIPTION 12=head1 DESCRIPTION
11 13
12This module does two things: First, it offers some utility functions that 14This module does two things: First, it offers some utility functions that
13might be useful for coroutines, and secondly, it integrates Coro into the 15might be useful for coroutines, and secondly, it integrates Coro into the
20 22
21That means that coroutines with the same or higher pripority as the 23That means that coroutines with the same or higher pripority as the
22coroutine running the main loop will inhibit event processing, while 24coroutine running the main loop will inhibit event processing, while
23coroutines of lower priority will get the CPU, but cannot completeley 25coroutines of lower priority will get the CPU, but cannot completeley
24inhibit event processing. 26inhibit event processing.
27
28=head2 RUNNING WITH OR WITHOUT A MAINLOOP
29
30In general, you should always run EV::loop, either in your main program,
31or in a separate coroutine. If you don't do that and all coroutines start
32waiting for some events, this module will run the event loop once, but
33this is very inefficient.
25 34
26=head1 FUNCTIONS 35=head1 FUNCTIONS
27 36
28=over 4 37=over 4
29 38
46 our $VERSION = '2.1'; 55 our $VERSION = '2.1';
47 56
48 local $^W = 0; # avoid redefine warning for Coro::ready; 57 local $^W = 0; # avoid redefine warning for Coro::ready;
49 XSLoader::load __PACKAGE__, $VERSION; 58 XSLoader::load __PACKAGE__, $VERSION;
50} 59}
60
61unshift @AnyEvent::REGISTRY, [Coro::EV => "EV::AnyEvent"];
51 62
52# relatively inefficient 63# relatively inefficient
53our $ev_idle = new Coro sub { 64our $ev_idle = new Coro sub {
54 while () { 65 while () {
55 EV::loop EV::LOOP_ONESHOT; 66 EV::loop EV::LOOP_ONESHOT;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines