… | |
… | |
50 | |
50 | |
51 | our $idle; # idle handler |
51 | our $idle; # idle handler |
52 | our $main; # main coroutine |
52 | our $main; # main coroutine |
53 | our $current; # current coroutine |
53 | our $current; # current coroutine |
54 | |
54 | |
55 | our $VERSION = '3.63'; |
55 | our $VERSION = '3.7'; |
56 | |
56 | |
57 | our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); |
57 | our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); |
58 | our %EXPORT_TAGS = ( |
58 | our %EXPORT_TAGS = ( |
59 | prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], |
59 | prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], |
60 | ); |
60 | ); |
… | |
… | |
249 | } |
249 | } |
250 | } |
250 | } |
251 | |
251 | |
252 | sub async_pool(&@) { |
252 | sub async_pool(&@) { |
253 | # this is also inlined into the unlock_scheduler |
253 | # this is also inlined into the unlock_scheduler |
|
|
254 | my $coro = (pop @pool) || do { |
254 | my $coro = (pop @pool or new Coro \&pool_handler); |
255 | my $coro = new Coro \&pool_handler; |
|
|
256 | $coro->{desc} = "async_pool"; |
|
|
257 | $coro |
|
|
258 | }; |
255 | |
259 | |
256 | $coro->{_invoke} = [@_]; |
260 | $coro->{_invoke} = [@_]; |
257 | $coro->ready; |
261 | $coro->ready; |
258 | |
262 | |
259 | $coro |
263 | $coro |