ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Coro/Coro.pm
(Generate patch)

Comparing cvsroot/Coro/Coro.pm (file contents):
Revision 1.182 by root, Fri May 9 22:29:05 2008 UTC vs.
Revision 1.193 by root, Sun Jun 29 00:28:17 2008 UTC

66 66
67our $idle; # idle handler 67our $idle; # idle handler
68our $main; # main coroutine 68our $main; # main coroutine
69our $current; # current coroutine 69our $current; # current coroutine
70 70
71our $VERSION = 4.6; 71our $VERSION = 4.743;
72 72
73our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); 73our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub);
74our %EXPORT_TAGS = ( 74our %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);
266 _pool_2 $cb; 266 _pool_2 $cb;
267 &schedule; 267 &schedule;
268 } 268 }
269 }; 269 };
270 270
271 if ($@) {
271 last if $@ eq "\3async_pool terminate\2\n"; 272 last if $@ eq "\3async_pool terminate\2\n";
272 warn $@ if $@; 273 warn $@;
274 }
273 } 275 }
274} 276}
275 277
276sub async_pool(&@) { 278sub async_pool(&@) {
277 # this is also inlined into the unlock_scheduler 279 # this is also inlined into the unlock_scheduler
611creating event callbacks that want to block. 613creating event callbacks that want to block.
612 614
613If your handler does not plan to block (e.g. simply sends a message to 615If your handler does not plan to block (e.g. simply sends a message to
614another coroutine, or puts some other coroutine into the ready queue), 616another coroutine, or puts some other coroutine into the ready queue),
615there is no reason to use C<unblock_sub>. 617there is no reason to use C<unblock_sub>.
618
619Note that you also need to use C<unblock_sub> for any other callbacks that
620are indirectly executed by any C-based event loop. For example, when you
621use a module that uses L<AnyEvent> (and you use L<Coro::AnyEvent>) and it
622provides callbacks that are the result of some event callback, then you
623must not block either, or use C<unblock_sub>.
616 624
617=cut 625=cut
618 626
619our @unblock_queue; 627our @unblock_queue;
620 628

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines