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

Comparing Coro/Coro.pm (file contents):
Revision 1.148 by root, Fri Oct 5 20:11:25 2007 UTC vs.
Revision 1.150 by root, Sat Oct 6 01:11:01 2007 UTC

50 50
51our $idle; # idle handler 51our $idle; # idle handler
52our $main; # main coroutine 52our $main; # main coroutine
53our $current; # current coroutine 53our $current; # current coroutine
54 54
55our $VERSION = '4.01'; 55our $VERSION = '4.02';
56 56
57our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); 57our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub);
58our %EXPORT_TAGS = ( 58our %EXPORT_TAGS = (
59 prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], 59 prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)],
60); 60);
471coroutine. This is just a free-form string you can associate with a coroutine. 471coroutine. This is just a free-form string you can associate with a coroutine.
472 472
473This method simply sets the C<< $coroutine->{desc} >> member to the given string. You 473This method simply sets the C<< $coroutine->{desc} >> member to the given string. You
474can modify this member directly if you wish. 474can modify this member directly if you wish.
475 475
476=item $coroutine->throw ([$scalar])
477
478If C<$throw> is specified and defined, it will be thrown as an exception
479inside the coroutine at the next convinient point in time (usually after
480it gains control at the next schedule/transfer/cede). Otherwise clears the
481exception object.
482
483The exception object will be thrown "as is" with the specified scalar in
484C<$@>, i.e. if it is a string, no line number or newline will be appended
485(unlike with C<die>).
486
487This can be used as a softer means than C<cancel> to ask a coroutine to
488end itself, although there is no guarentee that the exception will lead to
489termination, and if the exception isn't caught it might well end the whole
490program.
491
476=cut 492=cut
477 493
478sub desc { 494sub desc {
479 my $old = $_[0]{desc}; 495 my $old = $_[0]{desc};
480 $_[0]{desc} = $_[1] if @_ > 1; 496 $_[0]{desc} = $_[1] if @_ > 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines