暂无描述

AWSCancellationToken.h 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2014, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. *
  9. */
  10. #import <Foundation/Foundation.h>
  11. #import "AWSCancellationTokenRegistration.h"
  12. NS_ASSUME_NONNULL_BEGIN
  13. /*!
  14. A block that will be called when a token is cancelled.
  15. */
  16. typedef void(^AWSCancellationBlock)(void);
  17. /*!
  18. The consumer view of a CancellationToken.
  19. Propagates notification that operations should be canceled.
  20. A AWSCancellationToken has methods to inspect whether the token has been cancelled.
  21. */
  22. @interface AWSCancellationToken : NSObject
  23. /*!
  24. Whether cancellation has been requested for this token source.
  25. */
  26. @property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested;
  27. /*!
  28. Register a block to be notified when the token is cancelled.
  29. If the token is already cancelled the delegate will be notified immediately.
  30. */
  31. - (AWSCancellationTokenRegistration *)registerCancellationObserverWithBlock:(AWSCancellationBlock)block;
  32. @end
  33. NS_ASSUME_NONNULL_END