… | |
… | |
813 | } |
813 | } |
814 | |
814 | |
815 | =item $coro->on_destroy (\&cb) |
815 | =item $coro->on_destroy (\&cb) |
816 | |
816 | |
817 | Registers a callback that is called when this coro thread gets destroyed, |
817 | Registers a callback that is called when this coro thread gets destroyed, |
818 | but before it is joined. The callback gets passed the terminate arguments, |
818 | that is, after it's resources have been freed but before it is joined. The |
|
|
819 | callback gets passed the terminate/cancel arguments, if any, and I<must |
819 | if any, and I<must not> die, under any circumstances. |
820 | not> die, under any circumstances. |
820 | |
821 | |
821 | There can be any number of C<on_destroy> callbacks per coro. |
822 | There can be any number of C<on_destroy> callbacks per coro, and there is |
|
|
823 | no way currently to remove a callback once added. |
822 | |
824 | |
823 | =cut |
825 | =cut |
824 | |
826 | |
825 | sub on_destroy { |
827 | sub on_destroy { |
826 | my ($self, $cb) = @_; |
828 | my ($self, $cb) = @_; |