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

Comparing Coro/Coro.pm (file contents):
Revision 1.230 by root, Thu Nov 20 07:02:43 2008 UTC vs.
Revision 1.233 by root, Fri Nov 21 06:02:07 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 = 5.0; 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);
225coros as required. 225coros as required.
226 226
227If you are concerned about pooled coroutines growing a lot because a 227If you are concerned about pooled coroutines growing a lot because a
228single C<async_pool> used a lot of stackspace you can e.g. C<async_pool 228single C<async_pool> used a lot of stackspace you can e.g. C<async_pool
229{ terminate }> once per second or so to slowly replenish the pool. In 229{ terminate }> once per second or so to slowly replenish the pool. In
230addition to that, when the stacks used by a handler grows larger than 16kb 230addition to that, when the stacks used by a handler grows larger than 32kb
231(adjustable via $Coro::POOL_RSS) it will also be destroyed. 231(adjustable via $Coro::POOL_RSS) it will also be destroyed.
232 232
233=cut 233=cut
234 234
235our $POOL_SIZE = 8; 235our $POOL_SIZE = 8;
236our $POOL_RSS = 16 * 1024; 236our $POOL_RSS = 32 * 1024;
237our @async_pool; 237our @async_pool;
238 238
239sub pool_handler { 239sub pool_handler {
240 while () { 240 while () {
241 eval { 241 eval {
496 496
497sub desc { 497sub desc {
498 my $old = $_[0]{desc}; 498 my $old = $_[0]{desc};
499 $_[0]{desc} = $_[1] if @_ > 1; 499 $_[0]{desc} = $_[1] if @_ > 1;
500 $old; 500 $old;
501}
502
503sub transfer {
504 require Carp;
505 Carp::croak ("You must not call ->transfer on Coro objects. Use Coro::State objects or the ->schedule_to method. Caught");
501} 506}
502 507
503=back 508=back
504 509
505=head2 GLOBAL FUNCTIONS 510=head2 GLOBAL FUNCTIONS

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines