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.37 by root, Mon Nov 20 19:56:04 2006 UTC vs.
Revision 1.38 by root, Mon Nov 20 20:14:02 2006 UTC

153 153
154This is the version of C<loop> you should use instead of C<Event::loop> 154This is the version of C<loop> you should use instead of C<Event::loop>
155when using this module - it will ensure correct scheduling in the presence 155when using this module - it will ensure correct scheduling in the presence
156of events. 156of events.
157 157
158=begin comment
159
160Unlike loop's counterpart it is not an error when no watchers are active -
161loop silently returns in this case, as if unloop(undef) were called.
162
163=end comment
164
165=cut
166
167# no longer do something special - it's done internally now
168
169#sub loop(;$) {
170# #local $Coro::idle = $Coro::current;
171# #Coro::schedule; # become idle task, which is implicitly ready
172# &Event::loop;
173#}
174
175=item unloop([$result]) 158=item unloop([$result])
176 159
177Same as Event::unloop (provided here for your convinience only). 160Same as Event::unloop (provided here for your convinience only).
178 161
179=cut 162=cut
180 163
181$Coro::idle = new Coro sub { 164$Coro::idle = new Coro sub {
182 while () { 165 while () {
166 Coro::schedule;
183 Event::one_event; # inefficient 167 Event::one_event; # inefficient
184 Coro::schedule;
185 } 168 }
186}; 169};
187 170
188# provide hooks for Coro::Timer 171# provide hooks for Coro::Timer
189 172

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines