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

Comparing Coro/Coro.pm (file contents):
Revision 1.96 by root, Mon Dec 4 03:48:16 2006 UTC vs.
Revision 1.97 by root, Mon Dec 4 13:47:56 2006 UTC

47 47
48our @EXPORT = qw(async cede schedule terminate current unblock_sub); 48our @EXPORT = qw(async cede schedule terminate current unblock_sub);
49our %EXPORT_TAGS = ( 49our %EXPORT_TAGS = (
50 prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], 50 prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)],
51); 51);
52our @EXPORT_OK = @{$EXPORT_TAGS{prio}}; 52our @EXPORT_OK = (@{$EXPORT_TAGS{prio}}, qw(nready));
53 53
54{ 54{
55 my @async; 55 my @async;
56 my $init; 56 my $init;
57 57
348 $old; 348 $old;
349} 349}
350 350
351=back 351=back
352 352
353=head2 UTILITY FUNCTIONS 353=head2 GLOBAL FUNCTIONS
354 354
355=over 4 355=over 4
356
357=item Coro::nready
358
359Returns the number of coroutines that are currently in the ready state,
360i.e. that can be swicthed to. The value C<0> means that the only runnable
361coroutine is the currently running one, so C<cede> would have no effect,
362and C<schedule> would cause a deadlock unless there is an idle handler
363that wakes up some coroutines.
356 364
357=item unblock_sub { ... } 365=item unblock_sub { ... }
358 366
359This utility function takes a BLOCK or code reference and "unblocks" it, 367This utility function takes a BLOCK or code reference and "unblocks" it,
360returning the new coderef. This means that the new coderef will return 368returning the new coderef. This means that the new coderef will return

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines