… | |
… | |
36 | |
36 | |
37 | use Coro::State; |
37 | use Coro::State; |
38 | |
38 | |
39 | use base Exporter; |
39 | use base Exporter; |
40 | |
40 | |
41 | $VERSION = 0.13; |
41 | $VERSION = 0.45; |
42 | |
42 | |
43 | @EXPORT = qw(async cede schedule terminate current); |
43 | @EXPORT = qw(async cede schedule terminate current); |
44 | @EXPORT_OK = qw($current); |
44 | @EXPORT_OK = qw($current); |
45 | |
45 | |
46 | { |
46 | { |
… | |
… | |
190 | Future versions of this function will allow result arguments. |
190 | Future versions of this function will allow result arguments. |
191 | |
191 | |
192 | =cut |
192 | =cut |
193 | |
193 | |
194 | sub terminate { |
194 | sub terminate { |
195 | push @destroy, $current; |
195 | $current->cancel; |
196 | $manager->ready; |
|
|
197 | &schedule; |
196 | &schedule; |
198 | # NORETURN |
197 | die; # NORETURN |
199 | } |
198 | } |
200 | |
199 | |
201 | =back |
200 | =back |
202 | |
201 | |
203 | # dynamic methods |
202 | # dynamic methods |
… | |
… | |
236 | |
235 | |
237 | =cut |
236 | =cut |
238 | |
237 | |
239 | sub ready { |
238 | sub ready { |
240 | push @ready, $_[0]; |
239 | push @ready, $_[0]; |
|
|
240 | } |
|
|
241 | |
|
|
242 | =item $process->cancel |
|
|
243 | |
|
|
244 | Like C<terminate>, but terminates the specified process instead. |
|
|
245 | |
|
|
246 | =cut |
|
|
247 | |
|
|
248 | sub cancel { |
|
|
249 | push @destroy, $_[0]; |
|
|
250 | $manager->ready; |
241 | } |
251 | } |
242 | |
252 | |
243 | =back |
253 | =back |
244 | |
254 | |
245 | =cut |
255 | =cut |