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.212 by root, Mon Nov 10 04:37:23 2008 UTC vs.
Revision 1.219 by root, Sun Nov 16 00:55:41 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.91; 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 fork with pthread backend
673
674When Coro is compiled using the pthread backend (which isn't recommended
675but required on many BSDs as their libcs are completely broken), then
676coroutines will not survive a fork. There is no known workaround except to
677fix your libc and use a saner backend.
678
679=item perl process emulation ("threads")
680
670This module is not perl-pseudo-thread-safe. You should only ever use this 681This 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 682module from the same thread (this requirement might be removed in the
672future to allow per-thread schedulers, but Coro::State does not yet allow 683future to allow per-thread schedulers, but Coro::State does not yet allow
673this). I recommend disabling thread support and using processes, as this 684this). I recommend disabling thread support and using processes, as having
674is much faster and uses less memory. 685the windows process emulation enabled under unix roughly halves perl
686performance, even when not used.
687
688=item coroutine switching not signal safe
689
690You must not switch to another coroutine from within a signal handler
691(only relevant with %SIG - most event libraries provide safe signals).
692
693That means you I<MUST NOT> call any fucntion that might "block" the
694current coroutine - C<cede>, C<schedule> C<< Coro::Semaphore->down >> or
695anything that calls those. Everything else, including calling C<ready>,
696works.
697
698=back
699
675 700
676=head1 SEE ALSO 701=head1 SEE ALSO
677 702
678Event-Loop integration: L<Coro::AnyEvent>, L<Coro::EV>, L<Coro::Event>. 703Event-Loop integration: L<Coro::AnyEvent>, L<Coro::EV>, L<Coro::Event>.
679 704

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines