… | |
… | |
66 | |
66 | |
67 | our $idle; # idle handler |
67 | our $idle; # idle handler |
68 | our $main; # main coroutine |
68 | our $main; # main coroutine |
69 | our $current; # current coroutine |
69 | our $current; # current coroutine |
70 | |
70 | |
71 | our $VERSION = 4.6; |
71 | our $VERSION = '4.71'; |
72 | |
72 | |
73 | our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); |
73 | our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); |
74 | our %EXPORT_TAGS = ( |
74 | our %EXPORT_TAGS = ( |
75 | prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], |
75 | prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], |
76 | ); |
76 | ); |
… | |
… | |
612 | |
612 | |
613 | If your handler does not plan to block (e.g. simply sends a message to |
613 | If your handler does not plan to block (e.g. simply sends a message to |
614 | another coroutine, or puts some other coroutine into the ready queue), |
614 | another coroutine, or puts some other coroutine into the ready queue), |
615 | there is no reason to use C<unblock_sub>. |
615 | there is no reason to use C<unblock_sub>. |
616 | |
616 | |
|
|
617 | Note that you also need to use C<unblock_sub> for any other callbacks that |
|
|
618 | are indirectly executed by any C-based event loop. For example, when you |
|
|
619 | use a module that uses L<AnyEvent> (and you use L<Coro::AnyEvent>) and it |
|
|
620 | provides callbacks that are the result of some event callback, then you |
|
|
621 | must not block either, or use C<unblock_sub>. |
|
|
622 | |
617 | =cut |
623 | =cut |
618 | |
624 | |
619 | our @unblock_queue; |
625 | our @unblock_queue; |
620 | |
626 | |
621 | # we create a special coro because we want to cede, |
627 | # we create a special coro because we want to cede, |