commit | author | age
|
bad748
|
1 |
/* |
W |
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 |
|
|
11 |
#import <Foundation/Foundation.h> |
|
12 |
|
|
13 |
#import <Bolts/BFCancellationTokenRegistration.h> |
|
14 |
|
|
15 |
NS_ASSUME_NONNULL_BEGIN |
|
16 |
|
|
17 |
/*! |
|
18 |
A block that will be called when a token is cancelled. |
|
19 |
*/ |
13e53a
|
20 |
typedef void(^BFCancellationBlock)(void); |
bad748
|
21 |
|
W |
22 |
/*! |
|
23 |
The consumer view of a CancellationToken. |
|
24 |
Propagates notification that operations should be canceled. |
|
25 |
A BFCancellationToken has methods to inspect whether the token has been cancelled. |
|
26 |
*/ |
|
27 |
@interface BFCancellationToken : NSObject |
|
28 |
|
|
29 |
/*! |
|
30 |
Whether cancellation has been requested for this token source. |
|
31 |
*/ |
|
32 |
@property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested; |
|
33 |
|
|
34 |
/*! |
|
35 |
Register a block to be notified when the token is cancelled. |
|
36 |
If the token is already cancelled the delegate will be notified immediately. |
|
37 |
*/ |
|
38 |
- (BFCancellationTokenRegistration *)registerCancellationObserverWithBlock:(BFCancellationBlock)block; |
|
39 |
|
|
40 |
@end |
|
41 |
|
|
42 |
NS_ASSUME_NONNULL_END |