… | |
… | |
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 | next_cancel (&$coronew); |
156 | @_ = &$coronew; |
|
|
157 | &Coro::schedule while &_next; |
|
|
158 | &_event |
157 | }; |
159 | }; |
|
|
160 | } |
|
|
161 | |
|
|
162 | # do schedule in perl to avoid forcing a stack allocation. |
|
|
163 | # this is about 10% slower, though. |
|
|
164 | sub next($) { |
|
|
165 | &Coro::schedule while &_next; |
|
|
166 | &_event |
158 | } |
167 | } |
159 | |
168 | |
160 | sub Coro::Event::Event::hits { $_[0][3] } |
169 | sub Coro::Event::Event::hits { $_[0][3] } |
161 | sub Coro::Event::Event::got { $_[0][4] } |
170 | sub Coro::Event::Event::got { $_[0][4] } |
162 | |
171 | |