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.211 by root, Mon Nov 10 00:02:29 2008 UTC vs.
Revision 1.218 by root, Sat Nov 15 06:26:52 2008 UTC

67 67
68our $idle; # idle handler 68our $idle; # idle handler
69our $main; # main coroutine 69our $main; # main coroutine
70our $current; # current coroutine 70our $current; # current coroutine
71 71
72our $VERSION = 4.9; 72our $VERSION = 5.0;
73 73
74our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); 74our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub);
75our %EXPORT_TAGS = ( 75our %EXPORT_TAGS = (
76 prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], 76 prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)],
77); 77);
275 } 275 }
276 } 276 }
277} 277}
278 278
279sub async_pool(&@) { 279sub async_pool(&@) {
280 # this is also inlined into the unlock_scheduler 280 # this is also inlined into the unblock_scheduler
281 my $coro = (pop @async_pool) || new Coro \&pool_handler; 281 my $coro = (pop @async_pool) || new Coro \&pool_handler;
282 282
283 $coro->{_invoke} = [@_]; 283 $coro->{_invoke} = [@_];
284 $coro->ready; 284 $coro->ready;
285 285
665 665
6661; 6661;
667 667
668=head1 BUGS/LIMITATIONS 668=head1 BUGS/LIMITATIONS
669 669
670=over 4
671
672=item perl process emulation ("threads")
673
670This module is not perl-pseudo-thread-safe. You should only ever use this 674This module is not perl-pseudo-thread-safe. You should only ever use this
671module from the same thread (this requirement might be removed in the 675module from the same thread (this requirement might be removed in the
672future to allow per-thread schedulers, but Coro::State does not yet allow 676future to allow per-thread schedulers, but Coro::State does not yet allow
673this). I recommend disabling thread support and using processes, as this 677this). I recommend disabling thread support and using processes, as having
674is much faster and uses less memory. 678the windows process emulation enabled under unix roughly halves perl
679performance, even when not used.
680
681=item coroutine switching not signal safe
682
683You must not switch to another coroutine from within a signal handler
684(only relevant with %SIG - most event libraries provide safe signals).
685
686That means you I<MUST NOT> call any fucntion that might "block" the
687current coroutine - C<cede>, C<schedule> C<< Coro::Semaphore->down >> or
688anything that calls those. Everything else, including calling C<ready>,
689works.
690
691=back
692
675 693
676=head1 SEE ALSO 694=head1 SEE ALSO
677 695
678Event-Loop integration: L<Coro::AnyEvent>, L<Coro::EV>, L<Coro::Event>. 696Event-Loop integration: L<Coro::AnyEvent>, L<Coro::EV>, L<Coro::Event>.
679 697

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines