forked from mikeash/MAFuture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAFutureInternal.h
82 lines (62 loc) · 2.07 KB
/
MAFutureInternal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#import "MABaseFuture.h"
@interface _MASimpleFuture : MABaseFuture
{
}
@end
@interface _MALazyBlockFuture : _MASimpleFuture
{
id (^_block)(void);
}
- (id)initWithBlock: (id (^)(void))block;
@end
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
@interface _IKMemoryAwareFuture : _MALazyBlockFuture {
BOOL isObserving;
BOOL isManuallyStopped;
NSInteger countOfUsers;
}
/*
@abstract Use this property to check if future is observing memory warning notification or not.
*/
@property (readonly) BOOL isObserving;
/*
@abstract Use this property to control observing of memory warning notifications. Instead of isObserving, it automatically disables observing when countOfUsers > 0 and reenables when countOfUsers == 0.
*/
@property NSInteger countOfUsers;
/*
@abstract Called in response to UIApplicationDidReceiveMemoryWarningNotification.
@discussion Starts processMemoryWarningUnlocked on background thread.
*/
- (void)processMemoryWarning;
/*
@abstract Releases future and sets _resolved to NO.
@discussion If you just want to release future, call 'invalidate' method instead.
*/
- (void)processMemoryWarningUnlocked;
/*
@abstract Releases future and sets _resolved to NO.
*/
- (void)invalidate;
- (void)invalidateUnlocked;
/*
@abstract Called whenever isObserver variable is changed.
@discussion You should not call this function directly from your code. Instead, you should use isObserving property
to start/stop observing memory warnings notifications.
*/
- (void)setIsObservingUnlocked:(BOOL)newIsObserving;
@end
NSString* IKMemoryAwareFuturesDirectory();
NSString* IKMemoryAwareFuturePath(id future);
@interface _IKAutoArchivingMemoryAwareFuture : _IKMemoryAwareFuture
/*
@abstract Archives value to the disk.
@result YES if value is archived without errors. Otherwise NO.
*/
- (BOOL)archiveValueUnlocked;
/*
@abstract Unarchives value from the disk.
@result YES if value is unarchived without errors. If either archive for future doesn't exist or error is occured, returns NO.
*/
- (BOOL)unarchiveValueUnlocked;
@end
#endif // __IPHONE_OS_VERSION_MAX_ALLOWED