Skip to main content

is_cancelled

Function is_cancelled 

Source
pub fn is_cancelled() -> bool
Expand description

Returns true if the work running on the current thread was cancelled.

This reads the state of the innermost CancelOnDrop::scope on this thread, for example a blocking RPC call whose request was dropped because the client disconnected. Long running work should check this between units of work, such as transactions, and stop early since nobody waits for the result.

Always returns false outside of a CancelOnDrop::scope.