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.220 by root, Sun Nov 16 11:12:57 2008 UTC vs.
Revision 1.223 by root, Tue Nov 18 10:44:07 2008 UTC

436} 436}
437 437
438=item $coroutine->throw ([$scalar]) 438=item $coroutine->throw ([$scalar])
439 439
440If C<$throw> is specified and defined, it will be thrown as an exception 440If C<$throw> is specified and defined, it will be thrown as an exception
441inside the coroutine at the next convenient point in time (usually after 441inside the coroutine at the next convenient point in time. Otherwise
442it gains control at the next schedule/transfer/cede). Otherwise clears the
443exception object. 442clears the exception object.
443
444Coro will check for the exception each time a schedule-like-function
445returns, i.e. after each C<schedule>, C<cede>, C<< Coro::Semaphore->down
446>>, C<< Coro::Handle->readable >> and so on. Most of these functions
447detect this case and return early in case an exception is pending.
444 448
445The exception object will be thrown "as is" with the specified scalar in 449The exception object will be thrown "as is" with the specified scalar in
446C<$@>, i.e. if it is a string, no line number or newline will be appended 450C<$@>, i.e. if it is a string, no line number or newline will be appended
447(unlike with C<die>). 451(unlike with C<die>).
448 452
680=item coroutine switching not signal safe 684=item coroutine switching not signal safe
681 685
682You must not switch to another coroutine from within a signal handler 686You must not switch to another coroutine from within a signal handler
683(only relevant with %SIG - most event libraries provide safe signals). 687(only relevant with %SIG - most event libraries provide safe signals).
684 688
685That means you I<MUST NOT> call any fucntion that might "block" the 689That means you I<MUST NOT> call any function that might "block" the
686current coroutine - C<cede>, C<schedule> C<< Coro::Semaphore->down >> or 690current coroutine - C<cede>, C<schedule> C<< Coro::Semaphore->down >> or
687anything that calls those. Everything else, including calling C<ready>, 691anything that calls those. Everything else, including calling C<ready>,
688works. 692works.
689 693
690=back 694=back

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines