class Concurrent::Future

def cancel

Returns:
  • (Boolean) - was the operation successfully cancelled.
def cancel
  if compare_and_set_state(:cancelled, :pending)
    complete(false, nil, CancelledOperationError.new)
    true
  else
    false
  end
end