-
Notifications
You must be signed in to change notification settings - Fork 72
/
UKMainThreadProxy.h
57 lines (40 loc) · 1.72 KB
/
UKMainThreadProxy.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
/* =============================================================================
FILE: UKMainThreadProxy.h
PROJECT: UKMainThreadProxy
PURPOSE: Send a message to object theObject to [theObject mainThreadProxy]
instead and the message will be received on the main thread by
theObject.
COPYRIGHT: (c) 2004 M. Uli Kusterer, all rights reserved.
AUTHORS: M. Uli Kusterer - UK
LICENSES: MIT License
REVISIONS:
2006-03-13 UK Clarified license.
2004-10-14 UK Created.
========================================================================== */
// -----------------------------------------------------------------------------
// Headers:
// -----------------------------------------------------------------------------
#import <Cocoa/Cocoa.h>
// -----------------------------------------------------------------------------
// Categories:
// -----------------------------------------------------------------------------
@interface NSObject (UKMainThreadProxy)
-(id) mainThreadProxy; // You can't init or release this object.
-(id) copyMainThreadProxy; // Gives you a retained version.
@end
// -----------------------------------------------------------------------------
// Classes:
// -----------------------------------------------------------------------------
/*
This object is created as a proxy in a second thread for an existing object.
All messages you send to this object will automatically be sent to the other
object on the main thread, except NSObject methods like retain/release etc.
*/
@interface UKMainThreadProxy : NSObject
{
IBOutlet id target;
BOOL waitForCompletion;
}
-(id) initWithTarget: (id)targ;
-(void) setWaitForCompletion: (BOOL)state;
@end