-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMABaseFuture.h
More file actions
35 lines (25 loc) · 768 Bytes
/
MABaseFuture.h
File metadata and controls
35 lines (25 loc) · 768 Bytes
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
#import <Foundation/Foundation.h>
#import "MAProxy.h"
@interface MABaseFuture : MAProxy
{
id _value;
NSCondition *_lock;
BOOL _resolved;
}
- (id)init;
// access value while holding the lock
// don't call the setter more than once
- (void)setFutureValue: (id)value;
- (id)futureValue;
// if you lock manually, you can use this
- (void)setFutureValueUnlocked: (id)value;
// checks to see if setFutureValue: has been called yet
// lock the lock first for best results
- (BOOL)futureHasResolved;
// if setFutureValue: has not been called yet, blocks until it has
// returns _value
- (id)waitForFutureResolution;
// subclasses must implement! don't call super!
// returns the future value, blocks for it to resolve if needed
- (id)resolveFuture;
@end