… | |
… | |
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.43; |
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 | ); |
… | |
… | |
1021 | otherwise you might suffer from crashes or worse. The only event library |
1021 | 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 |
1022 | 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). |
1023 | you might still run into deadlocks if all event loops are blocked). |
1024 | |
1024 | |
1025 | Coro will try to catch you when you block in the event loop |
1025 | 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 |
1026 | ("FATAL: $Coro::idle blocked itself"), but this is just best effort and |
1027 | only works when you do not run your own event loop. |
1027 | only works when you do not run your own event loop. |
1028 | |
1028 | |
1029 | This function allows your callbacks to block by executing them in another |
1029 | 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 |
1030 | 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 |
1031 | is when you use the L<Coro::AIO|Coro::AIO> functions to save results to |