… | |
… | |
366 | |
366 | |
367 | our $idle; # idle handler |
367 | our $idle; # idle handler |
368 | our $main; # main coro |
368 | our $main; # main coro |
369 | our $current; # current coro |
369 | our $current; # current coro |
370 | |
370 | |
371 | our $VERSION = 6.41; |
371 | our $VERSION = 6.51; |
372 | |
372 | |
373 | our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub rouse_cb rouse_wait); |
373 | our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub rouse_cb rouse_wait); |
374 | our %EXPORT_TAGS = ( |
374 | our %EXPORT_TAGS = ( |
375 | prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], |
375 | prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], |
376 | ); |
376 | ); |
… | |
… | |
498 | C<async> does. As the coro is being reused, stuff like C<on_destroy> |
498 | C<async> does. As the coro is being reused, stuff like C<on_destroy> |
499 | will not work in the expected way, unless you call terminate or cancel, |
499 | will not work in the expected way, unless you call terminate or cancel, |
500 | which somehow defeats the purpose of pooling (but is fine in the |
500 | which somehow defeats the purpose of pooling (but is fine in the |
501 | exceptional case). |
501 | exceptional case). |
502 | |
502 | |
503 | The priority will be reset to C<0> after each run, tracing will be |
503 | The priority will be reset to C<0> after each run, all C<swap_sv> calls |
504 | disabled, the description will be reset and the default output filehandle |
504 | will be undone, tracing will be disabled, the description will be reset |
505 | gets restored, so you can change all these. Otherwise the coro will |
505 | and the default output filehandle gets restored, so you can change all |
506 | be re-used "as-is": most notably if you change other per-coro global |
506 | these. Otherwise the coro will be re-used "as-is": most notably if you |
507 | stuff such as C<$/> you I<must needs> revert that change, which is most |
507 | change other per-coro global stuff such as C<$/> you I<must needs> revert |
508 | simply done by using local as in: C<< local $/ >>. |
508 | that change, which is most simply done by using local as in: C<< local $/ |
|
|
509 | >>. |
509 | |
510 | |
510 | The idle pool size is limited to C<8> idle coros (this can be |
511 | The idle pool size is limited to C<8> idle coros (this can be |
511 | adjusted by changing $Coro::POOL_SIZE), but there can be as many non-idle |
512 | adjusted by changing $Coro::POOL_SIZE), but there can be as many non-idle |
512 | coros as required. |
513 | coros as required. |
513 | |
514 | |
… | |
… | |
1021 | otherwise you might suffer from crashes or worse. The only event library |
1022 | otherwise you might suffer from crashes or worse. The only event library |
1022 | currently known that is safe to use without C<unblock_sub> is L<EV> (but |
1023 | currently known that is safe to use without C<unblock_sub> is L<EV> (but |
1023 | you might still run into deadlocks if all event loops are blocked). |
1024 | you might still run into deadlocks if all event loops are blocked). |
1024 | |
1025 | |
1025 | Coro will try to catch you when you block in the event loop |
1026 | Coro will try to catch you when you block in the event loop |
1026 | ("FATAL:$Coro::idle blocked itself"), but this is just best effort and |
1027 | ("FATAL: $Coro::idle blocked itself"), but this is just best effort and |
1027 | only works when you do not run your own event loop. |
1028 | only works when you do not run your own event loop. |
1028 | |
1029 | |
1029 | This function allows your callbacks to block by executing them in another |
1030 | This function allows your callbacks to block by executing them in another |
1030 | coro where it is safe to block. One example where blocking is handy |
1031 | coro where it is safe to block. One example where blocking is handy |
1031 | is when you use the L<Coro::AIO|Coro::AIO> functions to save results to |
1032 | is when you use the L<Coro::AIO|Coro::AIO> functions to save results to |
… | |
… | |
1301 | |
1302 | |
1302 | XS API: L<Coro::MakeMaker>. |
1303 | XS API: L<Coro::MakeMaker>. |
1303 | |
1304 | |
1304 | Low level Configuration, Thread Environment, Continuations: L<Coro::State>. |
1305 | Low level Configuration, Thread Environment, Continuations: L<Coro::State>. |
1305 | |
1306 | |
1306 | =head1 AUTHOR |
1307 | =head1 AUTHOR/SUPPORT/CONTACT |
1307 | |
1308 | |
1308 | Marc Lehmann <schmorp@schmorp.de> |
1309 | Marc A. Lehmann <schmorp@schmorp.de> |
1309 | http://home.schmorp.de/ |
1310 | http://software.schmorp.de/pkg/Coro.html |
1310 | |
1311 | |
1311 | =cut |
1312 | =cut |
1312 | |
1313 | |