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

Comparing Coro/Event/Event.pm (file contents):
Revision 1.7 by root, Tue Oct 9 00:50:32 2001 UTC vs.
Revision 1.8 by root, Sun Oct 28 17:00:09 2001 UTC

16 print "data> "; 16 print "data> ";
17 my $ev = $w->next; my $data = <STDIN>; 17 my $ev = $w->next; my $data = <STDIN>;
18 } 18 }
19 } 19 }
20 20
21 &loop; 21 loop;
22 22
23=head1 DESCRIPTION 23=head1 DESCRIPTION
24 24
25This module enables you to create programs using the powerful Event model 25This module enables you to create programs using the powerful Event model
26(and module), while retaining the linear style known from simple or 26(and module), while retaining the linear style known from simple or
43no warnings qw(uninitialized); 43no warnings qw(uninitialized);
44 44
45use Carp; 45use Carp;
46 46
47use Coro; 47use Coro;
48use Event qw(unloop); # we are re-exporting this, cooool! 48use Event qw(loop unloop); # we are re-exporting this, cooool!
49 49
50use base 'Exporter'; 50use base 'Exporter';
51 51
52@EXPORT = qw(loop unloop sweep reschedule); 52@EXPORT = qw(loop unloop sweep reschedule);
53 53
108 }; 108 };
109 *{ $flavour } = $coronew; 109 *{ $flavour } = $coronew;
110 *{"do_$flavour"} = sub { 110 *{"do_$flavour"} = sub {
111 unshift @_, Coro::Event::; 111 unshift @_, Coro::Event::;
112 my $e = (&$coronew)->next; 112 my $e = (&$coronew)->next;
113 $e->cancel; # $e = $e->w 113 $e->cancel; # $e = $e->w->cancel ($e == $e->w!)
114 $e; 114 $e;
115 }; 115 };
116} 116}
117 117
118# double calls to avoid stack-cloning ;() 118# double calls to avoid stack-cloning ;()
156 156
157=end comment 157=end comment
158 158
159=cut 159=cut
160 160
161# no longer do something special - it's done internally now
162
161sub loop(;$) { 163#sub loop(;$) {
162 local $Coro::idle = $Coro::current; 164# #local $Coro::idle = $Coro::current;
163 Coro::schedule; # become idle task, which is implicitly ready 165# #Coro::schedule; # become idle task, which is implicitly ready
164 &Event::loop; 166# &Event::loop;
165} 167#}
166 168
167=item unloop([$result]) 169=item unloop([$result])
168 170
169Same as Event::unloop (provided here for your convinience only). 171Same as Event::unloop (provided here for your convinience only).
170 172

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines