class Concurrent::Cancellation

The Cancellation abstraction provides cooperative cancellation.

The standard methods ‘Thread#raise` of `Thread#kill` available in Ruby are very dangerous (see linked the blog posts bellow). Therefore concurrent-ruby provides an alternative.

It provides an object which represents a task which can be executed, the task has to get the reference to the object and periodically cooperatively check that it is not cancelled. Good practices to make tasks cancellable:

The idea was inspired by <msdn.microsoft.com/en-us/library/dd537607(v=vs.110).aspx> @!macro warn.edge

{include:file:docs-source/cancellation.out.md}