… | |
… | |
224 | The pool size is limited to 8 idle coroutines (this can be adjusted by |
224 | The pool size is limited to 8 idle coroutines (this can be adjusted by |
225 | changing $Coro::POOL_SIZE), and there can be as many non-idle coros as |
225 | changing $Coro::POOL_SIZE), and there can be as many non-idle coros as |
226 | required. |
226 | required. |
227 | |
227 | |
228 | If you are concerned about pooled coroutines growing a lot because a |
228 | If you are concerned about pooled coroutines growing a lot because a |
229 | single C<async_pool> used a lot of stackspace you can e.g. C<async_pool { |
229 | single C<async_pool> used a lot of stackspace you can e.g. C<async_pool |
230 | terminate }> once per second or so to slowly replenish the pool. |
230 | { terminate }> once per second or so to slowly replenish the pool. In |
|
|
231 | addition to that, when the stacks used by a handler grows larger than 16kb |
|
|
232 | (adjustable with $Coro::MAX_POOL_RSS) it will also exit. |
231 | |
233 | |
232 | =cut |
234 | =cut |
233 | |
235 | |
234 | our $POOL_SIZE = 8; |
236 | our $POOL_SIZE = 8; |
235 | our $MAX_POOL_RSS = 64 * 1024; |
237 | our $MAX_POOL_RSS = 16 * 1024; |
236 | our @pool; |
238 | our @pool; |
237 | |
239 | |
238 | sub pool_handler { |
240 | sub pool_handler { |
239 | while () { |
241 | while () { |
240 | $current->{desc} = "[async_pool]"; |
242 | $current->{desc} = "[async_pool]"; |