… | |
… | |
466 | and C<schedule> would cause a deadlock unless there is an idle handler |
466 | and C<schedule> would cause a deadlock unless there is an idle handler |
467 | that wakes up some coroutines. |
467 | that wakes up some coroutines. |
468 | |
468 | |
469 | =item my $guard = Coro::guard { ... } |
469 | =item my $guard = Coro::guard { ... } |
470 | |
470 | |
471 | This creates and returns a guard object. Nothing happens until the objetc |
471 | This creates and returns a guard object. Nothing happens until the object |
472 | gets destroyed, in which case the codeblock given as argument will be |
472 | gets destroyed, in which case the codeblock given as argument will be |
473 | executed. This is useful to free locks or other resources in case of a |
473 | executed. This is useful to free locks or other resources in case of a |
474 | runtime error or when the coroutine gets canceled, as in both cases the |
474 | runtime error or when the coroutine gets canceled, as in both cases the |
475 | guard block will be executed. The guard object supports only one method, |
475 | guard block will be executed. The guard object supports only one method, |
476 | C<< ->cancel >>, which will keep the codeblock from being executed. |
476 | C<< ->cancel >>, which will keep the codeblock from being executed. |