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

Comparing Coro/Coro.pm (file contents):
Revision 1.92 by root, Fri Dec 1 03:47:55 2006 UTC vs.
Revision 1.94 by root, Sat Dec 2 18:01:30 2006 UTC

57 57
58 # this way of handling attributes simply is NOT scalable ;() 58 # this way of handling attributes simply is NOT scalable ;()
59 sub import { 59 sub import {
60 no strict 'refs'; 60 no strict 'refs';
61 61
62 Coro->export_to_level(1, @_); 62 Coro->export_to_level (1, @_);
63 63
64 my $old = *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"}{CODE}; 64 my $old = *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"}{CODE};
65 *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"} = sub { 65 *{(caller)[0]."::MODIFY_CODE_ATTRIBUTES"} = sub {
66 my ($package, $ref) = (shift, shift); 66 my ($package, $ref) = (shift, shift);
67 my @attrs; 67 my @attrs;
105C<Coro::current> function instead. 105C<Coro::current> function instead.
106 106
107=cut 107=cut
108 108
109# maybe some other module used Coro::Specific before... 109# maybe some other module used Coro::Specific before...
110if ($current) {
111 $main->{specific} = $current->{specific}; 110$main->{specific} = $current->{specific}
112} 111 if $current;
113 112
114$current = $main; 113_set_current $main;
115 114
116sub current() { $current } 115sub current() { $current }
117 116
118=item $idle 117=item $idle
119 118
255 254
256Calling C<exit> in a coroutine will not work correctly, so do not do that. 255Calling C<exit> in a coroutine will not work correctly, so do not do that.
257 256
258=cut 257=cut
259 258
260sub _new_coro { 259sub _run_coro {
261 terminate &{+shift}; 260 terminate &{+shift};
262} 261}
263 262
264sub new { 263sub new {
265 my $class = shift; 264 my $class = shift;
266 265
267 $class->SUPER::new (\&_new_coro, @_) 266 $class->SUPER::new (\&_run_coro, @_)
268} 267}
269 268
270=item $success = $coroutine->ready 269=item $success = $coroutine->ready
271 270
272Put the given coroutine into the ready queue (according to it's priority) 271Put the given coroutine into the ready queue (according to it's priority)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines