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.48 by root, Wed Jan 24 16:24:21 2007 UTC vs.
Revision 1.49 by root, Tue Oct 9 22:29:27 2007 UTC

138 138
139 shift eq Coro::Event:: 139 shift eq Coro::Event::
140 or croak "event constructor \"Coro::Event->$flavour\" must be called as a static method"; 140 or croak "event constructor \"Coro::Event->$flavour\" must be called as a static method";
141 141
142 my $w = $new->($class, 142 my $w = $new->($class,
143 desc => $flavour, 143 desc => $flavour,
144 @_, 144 @_,
145 parked => 1, 145 parked => 1,
146 ); 146 );
147 147
148 _install_std_cb $w, $type; 148 _install_std_cb $w, $type;
149 149
150 # reblessing due to Event being broken 150 # reblessing due to Event being broken
151 bless $w, $class 151 bless $w, $class
152 }; 152 };
153 *{ $flavour } = $coronew; 153 *{ $flavour } = $coronew;
154 *{"do_$flavour"} = sub { 154 *{"do_$flavour"} = sub {
155 unshift @_, Coro::Event::; 155 unshift @_, Coro::Event::;
156 @_ = &$coronew; 156 next_cancel (&$coronew);
157 &Coro::schedule while &_next;
158 $_[0]->cancel;
159 &_event
160 }; 157 };
161}
162
163# do schedule in perl to avoid forcing a stack allocation.
164# this is about 10% slower, though.
165sub next($) {
166 &Coro::schedule while &_next;
167
168 &_event
169} 158}
170 159
171sub Coro::Event::Event::hits { $_[0][3] } 160sub Coro::Event::Event::hits { $_[0][3] }
172sub Coro::Event::Event::got { $_[0][4] } 161sub Coro::Event::Event::got { $_[0][4] }
173 162

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines