Function tarantool::fiber::is_cancelled
source · pub fn is_cancelled() -> bool
Expand description
Check current fiber for cancellation (it must be checked manually).
NOTE: Any yield is a cancel point be that implicit or explicit yield. This
includes calling fiber::start
, inserting data into spaces, doing rpc,
working with fiber::Channel
or fiber::Cond
, etc. Because of rust’s
explicit error handling style it would not be useful to make all of these
api methods automatically handle the fiber cancelation, because checking
their result for some FiberCancelled
error variant would be equivalent to
just explicitly calling is_cancelled
after each of those calls.
For this reason, if you suspect that your fiber may be cancelled at some
point, you should design it such that it explicitly calls is_cancelled
(for example once per some endless loop iteration) and finishes execution,
otherwise the fiber’s memory may leak.