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

Comparing Coro/Coro.pm (file contents):
Revision 1.346 by root, Fri Jul 14 23:20:07 2017 UTC vs.
Revision 1.347 by root, Thu Aug 31 16:24:19 2017 UTC

782=item $is_suspended = $coro->is_suspended 782=item $is_suspended = $coro->is_suspended
783 783
784Returns true iff this Coro object has been suspended. Suspended Coros will 784Returns true iff this Coro object has been suspended. Suspended Coros will
785not ever be scheduled. 785not ever be scheduled.
786 786
787=item $coro->cancel (arg...) 787=item $coro->cancel ($arg...)
788 788
789Terminates the given Coro thread and makes it return the given arguments as 789Terminate the given Coro thread and make it return the given arguments as
790status (default: an empty list). Never returns if the Coro is the 790status (default: an empty list). Never returns if the Coro is the
791current Coro. 791current Coro.
792 792
793This is a rather brutal way to free a coro, with some limitations - if 793This is a rather brutal way to free a coro, with some limitations - if
794the thread is inside a C callback that doesn't expect to be canceled, 794the thread is inside a C callback that doesn't expect to be canceled,
830context and can block if they wish. The downside is that there is no 830context and can block if they wish. The downside is that there is no
831guarantee that the thread can be cancelled when you call this method, and 831guarantee that the thread can be cancelled when you call this method, and
832therefore, it might fail. It is also considerably slower than C<cancel> or 832therefore, it might fail. It is also considerably slower than C<cancel> or
833C<terminate>. 833C<terminate>.
834 834
835A thread is in a safe-cancellable state if it either hasn't been run yet, 835A thread is in a safe-cancellable state if it either has never been run
836yet, has already been canceled/terminated or otherwise destroyed, or has
836or it has no C context attached and is inside an SLF function. 837no C context attached and is inside an SLF function.
837 838
839The first two states are trivial - a thread that hasnot started or has
840already finished is safe to cancel.
841
838The latter two basically mean that the thread isn't currently inside a 842The last state basically means that the thread isn't currently inside a
839perl callback called from some C function (usually via some XS modules) 843perl callback called from some C function (usually via some XS modules)
840and isn't currently executing inside some C function itself (via Coro's XS 844and isn't currently executing inside some C function itself (via Coro's XS
841API). 845API).
842 846
843This call returns true when it could cancel the thread, or croaks with an 847This call returns true when it could cancel the thread, or croaks with an

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines